Enhance logging and error handling in collection access methods and WSGI configuration
This commit is contained in:
+4
-1
@@ -1256,6 +1256,7 @@ class Series(SeriesBase):
|
||||
|
||||
|
||||
class CaseCollection(ExamOrCollectionGenericBase):
|
||||
|
||||
app_name = "atlas"
|
||||
|
||||
cases = models.ManyToManyField(Case, through="CaseDetail")
|
||||
@@ -1518,7 +1519,9 @@ class CaseCollection(ExamOrCollectionGenericBase):
|
||||
Extend base check_user_can_take to also require completion of any
|
||||
prerequisite collections.
|
||||
"""
|
||||
# Perform the normal access checks first
|
||||
logger.error("Checking if user can take collection with prerequisites")
|
||||
logger.error(f"CID: {cid}, user: {user}, active_only: {active_only}")
|
||||
#` Perform the normal access checks first
|
||||
super().check_user_can_take(cid, passcode, user=user, active_only=active_only)
|
||||
|
||||
# If there are prerequisites, the user (or CID) must have completed them
|
||||
|
||||
@@ -4002,6 +4002,8 @@ def collection_take_start(request, pk, cid=None, passcode=None):
|
||||
valid_user = True
|
||||
except Http404:
|
||||
valid_user = False
|
||||
except collection.InactiveException as e:
|
||||
return HttpResponse(f"<h1>{str(e)}</h1>")
|
||||
except PrerequisiteRequired as e:
|
||||
# Show a friendly page linking to the required collection rather than 404
|
||||
prereq = getattr(e, 'prereq', None)
|
||||
@@ -4034,6 +4036,8 @@ def collection_take_start(request, pk, cid=None, passcode=None):
|
||||
return render(
|
||||
request, "atlas/collection_review_start.html", template_variables
|
||||
)
|
||||
case _:
|
||||
return HttpResponse(f"Unknown collection type {collection.collection_type}")
|
||||
|
||||
|
||||
def _case_number_for_collection_and_caseid(collection_pk, case_id):
|
||||
|
||||
Reference in New Issue
Block a user