diff --git a/django/core/context_processors.py b/django/core/context_processors.py index 2ae9a6d972..f4b288dfc4 100644 --- a/django/core/context_processors.py +++ b/django/core/context_processors.py @@ -51,15 +51,19 @@ def request(request): class PermLookupDict(object): def __init__(self, user, module_name): self.user, self.module_name = user, module_name + def __repr__(self): - return str(self.user.get_permission_list()) + return str(self.user.get_all_permissions()) + 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) class PermWrapper(object): def __init__(self, user): self.user = user + def __getitem__(self, module_name): return PermLookupDict(self.user, module_name)