#NEWLINE# def get_unknown_equipment_model( session ) : #NEWLINE# #INDENT# cat = session . query ( models . EquipmentCategory ) . filter ( ( models . EquipmentCategory . name == 'unknown' ) ) . one ( ) #NEWLINE# q = session . query ( models . EquipmentModel ) . filter ( models . and_ ( ( models . EquipmentModel . name == 'Unknown' ) , ( models . EquipmentModel . category == cat ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# model = q . one ( ) #NEWLINE# #UNINDENT# except models . NoResultFound : #NEWLINE# #INDENT# manu = session . query ( models . Corporation ) . filter ( ( models . Corporation . name == 'Custom' ) ) . one ( ) #NEWLINE# model = models . create ( models . EquipmentModel , name = 'Unknown' , category = cat , manufacturer = manu ) #NEWLINE# session . add ( model ) #NEWLINE# session . commit ( ) #NEWLINE# #UNINDENT# return model