Opened 19 years ago

Closed 19 years ago

Last modified 18 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: no UI/UX: no

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 by garthk, 19 years ago

Or, fix #797. :)

comment:2 by Adrian Holovaty, 19 years ago

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