Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#796 closed defect (fixed)

Return no permission rather than a traceback for anonymous users

Reported by: garthk Owned by: adrian
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:

Description

Quick and easy patch:

Index: django/core/extensions.py
===================================================================
--- django/core/extensions.py   (revision 1234)
+++ django/core/extensions.py   (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 9 years ago by garthk

Or, fix #797. :)

comment:2 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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

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