mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
magic-removal: Removed some unused duplicated code.
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2568 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
01babca674
commit
dd8b60bd17
@ -21,22 +21,3 @@ def get_list_or_404(klass, **kwargs):
|
|||||||
if not obj_list:
|
if not obj_list:
|
||||||
raise Http404
|
raise Http404
|
||||||
return obj_list
|
return obj_list
|
||||||
|
|
||||||
# PermWrapper and PermLookupDict proxy the permissions system into objects that
|
|
||||||
# the template system can understand.
|
|
||||||
|
|
||||||
class PermLookupDict:
|
|
||||||
def __init__(self, user, module_name):
|
|
||||||
self.user, self.module_name = user, module_name
|
|
||||||
def __repr__(self):
|
|
||||||
return str(self.user.get_permission_list())
|
|
||||||
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:
|
|
||||||
def __init__(self, user):
|
|
||||||
self.user = user
|
|
||||||
def __getitem__(self, module_name):
|
|
||||||
return PermLookupDict(self.user, module_name)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user