Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#796 closed defect (fixed)

Return no permission rather than a traceback for anonymous users

Reported by: garthk Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Quick and easy patch:

Index: django/core/
--- django/core/   (revision 1234)
+++ django/core/   (working copy)
@@ -55,7 +55,8 @@
     def __getitem__(self, perm_name):
         return self.user.has_perm("%s.%s" % (self.module_name, perm_name))
     def __nonzero__(self):
-        return self.user.has_module_perms(self.module_name)
+        return hasattr(self.user, 'has_module_perms') \
+                and self.user.has_module_perms(self.module_name)

 class PermWrapper:
     def __init__(self, user):

Change History (2)

comment:1 Changed 13 years ago by garthk

Or, fix #797. :)

comment:2 Changed 13 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [1243]) Fixed #796 -- Gave AnonymousUser a has_module_perms method.

Note: See TracTickets for help on using tickets.
Back to Top