#NEWLINE# def _save_image( self , image ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# meta = { #NEWLINE# #INDENT# 'type' : type ( image ) . __name__ , #NEWLINE# #UNINDENT# } #NEWLINE# for mdprop in image . metadata ( ) : #NEWLINE# #INDENT# meta [ mdprop ] = getattr ( image , mdprop , None ) #NEWLINE# #UNINDENT# self . collection . update ( { #NEWLINE# #INDENT# '_id' : image . identifier , #NEWLINE# #UNINDENT# } , self . _to_mongo_meta ( meta ) , upsert = True ) #NEWLINE# self . log . debug ( ( 'Saved metadata for image (%s): %s' % ( image . identifier , meta ) ) ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . log . debug ( ( 'Exception caught: %s' % e ) ) #NEWLINE# raise ImageFactoryException ( ( 'Unable to save image metadata: %s' % e ) )