#NEWLINE# def ralph_item( * args , **kwargs ) : #NEWLINE# #INDENT# kwargs . setdefault ( 'access_loggedin' , True ) #NEWLINE# access_by_perms = kwargs . get ( 'access_by_perms' , [ ] ) #NEWLINE# if isinstance ( access_by_perms , ( str , int ) ) : #NEWLINE# #INDENT# access_by_perms = [ access_by_perms ] #NEWLINE# #UNINDENT# for child in kwargs . get ( 'children' , [ ] ) : #NEWLINE# #INDENT# if ( hasattr ( child , '_model' ) and hasattr ( child , '_app' ) ) : #NEWLINE# #INDENT# model = child . _model . lower ( ) #NEWLINE# app = child . _app . lower ( ) #NEWLINE# access_by_perms . extend ( [ '{}.add_{}' . format ( app , model ) , '{}.change_{}' . format ( app , model ) , '{}.view_{}' . format ( app , model ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( child , 'permissions' ) : #NEWLINE# #INDENT# access_by_perms . extend ( child . permissions ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if access_by_perms : #NEWLINE# #INDENT# kwargs [ 'access_by_perms' ] = list ( set ( access_by_perms ) ) #NEWLINE# #UNINDENT# return item ( * args , ** args )