diff --git a/biscuit/core/views.py b/biscuit/core/views.py index 4ce937938f7ce232569a12bdfeee8580b3d173e2..e56a0ddd4bcaa1241b630bc932b0e619011e66a6 100644 --- a/biscuit/core/views.py +++ b/biscuit/core/views.py @@ -12,36 +12,22 @@ def index(request): context = {} return render(request, 'core/index.html', context) +def error_handler(status): + def real_handler(request, *args, **kwargs): + context = {} -def handler404(request, exception): - context = {} - - error = 404 - context['error'] = error - - admins = settings.ADMINS - context['admins'] = admins - - message = _('This page does not exist. If you were redirected by a link on an external page, it would be possible that the link was wrong. But it you were redirected to this page by a link on this site, please contact one of the following contacts.') - context['message'] = message - - return render(request, 'error.html', context, status=404) - - -def handler500(request): - context = {} - - error = 500 - context['error'] = error - - admins = settings.ADMINS - context['admins'] = admins + context['status'] = status + context['caption'] = _('Page not found') + context['admins'] = settings.ADMINS - message = _('An unexpected error has occurred. This is probably due a bug in BiscuIT. Please contact one of the following contacts.') - context['message'] = message + if status == 404: + context['message'] = _('This page does not exist. If you were redirected by a link on an external page, it is possible that that link was outdated.') + elif status == 500: + context['message'] = _('An unexpected error has occurred.') - return render(request, 'error.html', context, status=500) + return render(request, 'error.html', context, status=status) + return real_handler @login_required def persons(request):