#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 , 20 years ago
comment:2 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Or, fix #797.
:)