Commit b2bb54c4 by Kálmán Viktor

common: humanize missing permissions error message

parent 2be155b5
......@@ -175,8 +175,9 @@ class Operation(object):
raise ImproperlyConfigured(
"Set required_perms to () if none needed.")
if not user.has_perms(cls.required_perms):
raise PermissionDenied(
u"%s doesn't have the required permissions." % user)
raise humanize_exception(ugettext_noop(
"You don't have the required permissions."),
PermissionDenied())
if cls.superuser_required and not user.is_superuser:
raise humanize_exception(ugettext_noop(
"Superuser privileges are required."), PermissionDenied())
......
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 sign in to comment