Django

Code

Show
Ignore:
Timestamp:
07/03/08 10:24:08 (3 months ago)
Author:
brosner
Message:

newforms-admin: Merged from trunk up to [7829].

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin

    • Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7814 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7829
  • django/branches/newforms-admin/django/contrib/auth/backends.py

    r7233 r7830  
     1try: 
     2    set 
     3except NameError: 
     4    from sets import Set as set # Python 2.3 fallback 
     5 
    16from django.db import connection 
    27from django.contrib.auth.models import User 
    38 
    4 try:  
    5     set  
    6 except NameError:  
    7     from sets import Set as set # Python 2.3 fallback 
    8          
     9 
    910class ModelBackend(object): 
    1011    """ 
    11     Authenticate against django.contrib.auth.models.User 
     12    Authenticates against django.contrib.auth.models.User. 
    1213    """ 
    1314    # TODO: Model, login attribute name and password attribute name should be 
     
    2223 
    2324    def get_group_permissions(self, user_obj): 
    24         "Returns a list of permission strings that this user has through his/her groups." 
     25        """ 
     26        Returns a set of permission strings that this user has through his/her 
     27        groups. 
     28        """ 
    2529        if not hasattr(user_obj, '_group_perm_cache'): 
    2630            cursor = connection.cursor() 
     
    5155            user_obj._group_perm_cache = set(["%s.%s" % (row[0], row[1]) for row in cursor.fetchall()]) 
    5256        return user_obj._group_perm_cache 
    53      
     57 
    5458    def get_all_permissions(self, user_obj): 
    5559        if not hasattr(user_obj, '_perm_cache'): 
     
    6266 
    6367    def has_module_perms(self, user_obj, app_label): 
    64         return bool(len([p for p in self.get_all_permissions(user_obj) if p[:p.index('.')] == app_label])) 
     68        """ 
     69        Returns True if user_obj has any permissions in the given app_label. 
     70        """ 
     71        for perm in self.get_all_permissions(user_obj): 
     72            if perm[:perm.index('.')] == app_label: 
     73                return True 
     74        return False 
    6575 
    6676    def get_user(self, user_id):