(self, image)
TODO: Docstring for save_image

        @param image TODO

        @return TODO
TODO: Docstring for save_image
TODO : Docstring for save_image
def save_image(self, image):
        """
        TODO: Docstring for save_image

        @param image TODO

        @return TODO
        """
        image_id = str(image.identifier)
        metadata_path = self.storage_path + '/' + image_id + METADATA_EXT
        if not os.path.isfile(metadata_path):
            raise ImageFactoryException('Image %s not managed, use "add_image()" first.' % image_id)
        try:
            meta = {'type': type(image).__name__}
            for mdprop in image.metadata():
                meta[mdprop] = getattr(image, mdprop, None)
 
            self.metadata_lock.acquire()
            try:
                mdf = open(metadata_path, 'w')
                json.dump(meta, mdf)
                mdf.close()
            finally:
                self.metadata_lock.release()

            self.log.debug("Saved metadata for image (%s): %s" % (image_id, meta))
        except Exception as e:
            self.log.debug('Exception caught: %s' % e)
            raise ImageFactoryException('Unable to save image metadata: %s' % e)
def save_image ( self , image ) : image_id = str ( image . identifier ) metadata_path = self . storage_path + '/' + image_id + METADATA_EXT if not os . path . isfile ( metadata_path ) : raise ImageFactoryException ( 'Image %s not managed, use "add_image()" first.' % image_id ) try : meta = { 'type' : type ( image ) . __name__ } for mdprop in image . metadata ( ) : meta [ mdprop ] = getattr ( image , mdprop , None ) self . metadata_lock . acquire ( ) try : mdf = open ( metadata_path , 'w' ) json . dump ( meta , mdf ) mdf . close ( ) finally : self . metadata_lock . release ( ) self . log . debug ( "Saved metadata for image (%s): %s" % ( image_id , meta ) ) except Exception as e : self . log . debug ( 'Exception caught: %s' % e ) raise ImageFactoryException ( 'Unable to save image metadata: %s' % e )