#NEWLINE# def from_uuid( self , uuid , session = None ) : #NEWLINE# #INDENT# 'Retrieve a :class:`Model` from its universally unique identifier\n``uuid``. If the ``uuid`` does not match any instance an exception will raise.\n' #NEWLINE# elems = uuid . split ( '.' ) #NEWLINE# if ( len ( elems ) == 2 ) : #NEWLINE# #INDENT# model = get_model_from_hash ( elems [ 0 ] ) #NEWLINE# if ( not elems ) : #NEWLINE# #INDENT# raise Model . DoesNotExist ( 'model id "{0}" not available' . format ( elems [ 0 ] ) ) #NEWLINE# #UNINDENT# if ( ( not session ) or ( session . router is not self ) ) : #NEWLINE# #INDENT# session = self . session ( ) #NEWLINE# #UNINDENT# return session . query ( model ) . get ( id = elems [ 1 ] ) #NEWLINE# #UNINDENT# raise Model . DoesNotExist ( 'uuid "{0}" not recognized' . format ( uuid ) )