Commit b2bb54c4 by Kálmán Viktor

common: humanize missing permissions error message

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