Commit 7b01147c by David Baumgold

Translate messages early

parent 8807d9fe
...@@ -48,17 +48,17 @@ def common_exceptions_400(func): ...@@ -48,17 +48,17 @@ def common_exceptions_400(func):
try: try:
return func(request, *args, **kwargs) return func(request, *args, **kwargs)
except User.DoesNotExist: except User.DoesNotExist:
message = "User does not exist." message = _("User does not exist.")
if use_json: if use_json:
return JsonResponse({"error": _(message)}, 400) return JsonResponse({"error": message}, 400)
else: else:
return HttpResponseBadRequest(_(message)) return HttpResponseBadRequest(message)
except AlreadyRunningError: except AlreadyRunningError:
message = "Task is already running." message = _("Task is already running.")
if use_json: if use_json:
return JsonResponse({"error": _(message)}, 400) return JsonResponse({"error": message}, 400)
else: else:
return HttpResponseBadRequest(_(message)) return HttpResponseBadRequest(message)
return wrapped return wrapped
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment