#NEWLINE# def find_first_object( self , ObjectClass , **kwargs ) : #NEWLINE# #INDENT# " Retrieve the first object matching the case sensitive filters in 'kwargs'. " #NEWLINE# query = ObjectClass . query #NEWLINE# for ( field_name , field_value ) in kwargs . items ( ) : #NEWLINE# #INDENT# field = getattr ( ObjectClass , field_name , None ) #NEWLINE# if ( field is None ) : #NEWLINE# #INDENT# raise KeyError ( ( "SQLAlchemyAdapter.find_first_object(): Class '%s' has no field '%s'." % ( ObjectClass , field_name ) ) ) #NEWLINE# #UNINDENT# query = query . filter ( ( field == field_value ) ) #NEWLINE# #UNINDENT# return query . first ( )