Browse files

Fixed a long and complex line by breaking into a for loop, with the a…

…dded benefit that the method will now exit as soon as a matching

permission is found instead of checking all of the user's permissions and putting them into a temporary list.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 73dfef8 commit 56e1cdc8bc7e5dfeb17178635df2de1e42f790ff @gdub gdub committed Jul 2, 2008
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/contrib/auth/
@@ -68,7 +68,10 @@ def has_module_perms(self, user_obj, app_label):
Returns True if user_obj has any permissions in the given app_label.
- return bool(len([p for p in self.get_all_permissions(user_obj) if p[:p.index('.')] == app_label]))
+ for perm in self.get_all_permissions(user_obj):
+ if perm[:perm.index('.')] == app_label:
+ return True
+ return False
def get_user(self, user_id):

0 comments on commit 56e1cdc

Please sign in to comment.