Reformat using black

This commit is contained in:
cuom1999 2022-05-14 12:57:27 -05:00
parent efee4ad081
commit a87fb49918
221 changed files with 19127 additions and 7310 deletions

View file

@ -5,29 +5,42 @@ from django.utils.translation import gettext as _
def error(request, context, status):
return render(request, 'error.html', context=context, status=status)
return render(request, "error.html", context=context, status=status)
def error404(request, exception=None):
# TODO: "panic: go back"
return render(request, 'generic-message.html', {
'title': _('404 error'),
'message': _('Could not find page "%s"') % request.path,
}, status=404)
return render(
request,
"generic-message.html",
{
"title": _("404 error"),
"message": _('Could not find page "%s"') % request.path,
},
status=404,
)
def error403(request, exception=None):
return error(request, {
'id': 'unauthorized_access',
'description': _('no permission for %s') % request.path,
'code': 403,
}, 403)
return error(
request,
{
"id": "unauthorized_access",
"description": _("no permission for %s") % request.path,
"code": 403,
},
403,
)
def error500(request):
return error(request, {
'id': 'invalid_state',
'description': _('corrupt page %s') % request.path,
'traceback': traceback.format_exc(),
'code': 500,
}, 500)
return error(
request,
{
"id": "invalid_state",
"description": _("corrupt page %s") % request.path,
"traceback": traceback.format_exc(),
"code": 500,
},
500,
)