#NEWLINE# def get_permissions_for( self , user ) : #NEWLINE# #INDENT# 'Mixin method to collect permissions for a model instance' #NEWLINE# pre = 'allows_' #NEWLINE# pre_len = len ( pre ) #NEWLINE# methods = ( m for m in dir ( self ) if m . startswith ( pre ) ) #NEWLINE# perms = dict ( ( ( m [ pre_len : ] , getattr ( self , m ) ( pre_len ) ) for m in methods ) ) #NEWLINE# return perms