Django

Code

Show
Ignore:
Timestamp:
07/02/08 00:05:50 (2 months ago)
Author:
gwilson
Message:

Fixed a long and complex line by breaking into a for loop, with the added 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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/auth/backends.py

    r7822 r7823  
    6969        Returns True if user_obj has any permissions in the given app_label. 
    7070        """ 
    71         return bool(len([p for p in self.get_all_permissions(user_obj) if p[:p.index('.')] == app_label])) 
     71        for perm in self.get_all_permissions(user_obj): 
     72            if perm[:perm.index('.')] == app_label: 
     73                return True 
     74        return False 
    7275 
    7376    def get_user(self, user_id):