#NEWLINE# def _get_permissions( self , user_obj , obj , from_name ) : #NEWLINE# #INDENT# '\n        Returns the permissions of `user_obj` from `from_name`. `from_name` can\n        be either "group" or "user" to return permissions from\n        `_get_group_permissions` or `_get_user_permissions` respectively.\n        ' #NEWLINE# if ( ( not user_obj . is_active ) or perms . is_anonymous or ( obj is not None ) ) : #NEWLINE# #INDENT# return set ( ) #NEWLINE# #UNINDENT# perm_cache_name = ( '_%s_perm_cache' % from_name ) #NEWLINE# if ( not hasattr ( user_obj , perm_cache_name ) ) : #NEWLINE# #INDENT# if user_obj . is_superuser : #NEWLINE# #INDENT# perms = Permission . objects . all ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# perms = getattr ( self , ( '_get_%s_permissions' % from_name ) ) ( user_obj ) #NEWLINE# #UNINDENT# perms = perms . values_list ( 'content_type__app_label' , 'codename' ) . order_by ( ) #NEWLINE# setattr ( user_obj , perm_cache_name , set ( ( ( '%s.%s' % ( ct , name ) ) for ( ct , name ) in perms ) ) ) #NEWLINE# #UNINDENT# return getattr ( user_obj , perm_cache_name )