#NEWLINE# def trait_view_for( self , info , view , object , object_name , trait_name ) : #NEWLINE# #INDENT# ' Gets a specified View object.\n        ' #NEWLINE# if isinstance ( view , ViewElement ) : #NEWLINE# #INDENT# return view #NEWLINE# #UNINDENT# klass = object . __class__ . __name__ #NEWLINE# cname = ( '%s_%s' % ( object_name , trait_name ) ) #NEWLINE# aview = '' #NEWLINE# if view : #NEWLINE# #INDENT# aview = ( '_' + view ) #NEWLINE# #UNINDENT# names = [ ( '%s_%s%s' % ( cname , klass , aview ) ) , ( '%s%s' % ( cname , aview ) ) , ( '%s%s' % ( klass , aview ) ) ] #NEWLINE# if view : #NEWLINE# #INDENT# names . append ( view ) #NEWLINE# #UNINDENT# for name in names : #NEWLINE# #INDENT# result = self . trait_view ( name ) #NEWLINE# if ( result is not None ) : #NEWLINE# #INDENT# return result #NEWLINE# #UNINDENT# method = getattr ( self , ( 'trait_view_for_%s' % name ) , None ) #NEWLINE# if callable ( method ) : #NEWLINE# #INDENT# result = method ( info , object ) #NEWLINE# if ( result is not None ) : #NEWLINE# #INDENT# return result #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ( object . trait_view ( view ) or object . trait_view ( ) )