#NEWLINE# @ classmethod #NEWLINE# def get( cls , name , default = None ) : #NEWLINE# #INDENT# '\n            Helper function to load a response.s3 variable from models\n        ' #NEWLINE# s3 = current . response . s3 #NEWLINE# if ( s3 is None ) : #NEWLINE# #INDENT# s3 = current . response . s3 = Storage ( ) #NEWLINE# #UNINDENT# if ( name in s3 ) : #NEWLINE# #INDENT# return s3 [ name ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( '_' in name ) : #NEWLINE# #INDENT# prefix = name . split ( '_' , 1 ) [ 0 ] #NEWLINE# models = current . models #NEWLINE# if hasattr ( models , prefix ) : #NEWLINE# #INDENT# module = models . __dict__ [ prefix ] #NEWLINE# loaded = False #NEWLINE# generic = [ ] #NEWLINE# for n in module . __all__ : #NEWLINE# #INDENT# model = module . __dict__ [ n ] #NEWLINE# if ( type ( model ) . __name__ == 'type' ) : #NEWLINE# #INDENT# if loaded : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if hasattr ( model , 'names' ) : #NEWLINE# #INDENT# if ( name in model . names ) : #NEWLINE# #INDENT# model ( prefix ) #NEWLINE# loaded = True #NEWLINE# generic = [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# generic . append ( n ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if n . startswith ( ( '%s_' % prefix ) ) : #NEWLINE# #INDENT# s3 [ n ] = model #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# [ module . __dict__ [ n ] ( prefix ) for n in generic ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( name in s3 ) : #NEWLINE# #INDENT# return s3 [ name ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( default , Exception ) : #NEWLINE# #INDENT# raise default #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return default