Ejemplo n.º 1
0
 def save_as(self, save_bundle, version=None):
     save_bundle = _DBLocator.save(self, save_bundle, True, version)
     for obj in save_bundle.get_db_objs():
         klass = self.get_convert_klass(obj.vtType)
         klass.convert(obj)
         obj.locator = self
     # Need to copy images into thumbnail cache directory so references
     # won't become invalid if they are in a temp dir that gets destroyed
     # when the previous locator is closed
     import shutil
     thumb_cache = ThumbnailCache.getInstance()
     thumb_cache_dir = thumb_cache.get_directory()
     new_thumbnails = []
     for thumbnail in save_bundle.thumbnails:
         if os.path.dirname(thumbnail) == thumb_cache_dir:
             new_thumbnails.append(thumbnail)
         else:
             cachedir_thumbnail = os.path.join(thumb_cache_dir,
                                               os.path.basename(thumbnail))
             try:
                 shutil.copyfile(thumbnail, cachedir_thumbnail)
                 new_thumbnails.append(cachedir_thumbnail)
             except Exception, e:
                 debug.critical('copying %s -> %s failed: %s' % \
                                    (thumbnail, cachedir_thumbnail, str(e)))
Ejemplo n.º 2
0
 def save(self, save_bundle):
     save_bundle = _DBLocator.save(self, save_bundle, False)
     for obj in save_bundle.get_db_objs():
         klass = self.get_convert_klass(obj.vtType)
         klass.convert(obj)
         obj.locator = self
     return save_bundle
 def save(self, save_bundle):
     save_bundle = _DBLocator.save(self, save_bundle, False)
     for obj in save_bundle.get_db_objs():
         klass = self.get_convert_klass(obj.vtType)
         klass.convert(obj)
         obj.locator = self
     return save_bundle
 def save_as(self, save_bundle, version=None):
     save_bundle = _DBLocator.save(self, save_bundle, True, version)
     for obj in save_bundle.get_db_objs():
         klass = self.get_convert_klass(obj.vtType)
         klass.convert(obj)
         obj.locator = self
     # Need to copy images into thumbnail cache directory so references
     # won't become invalid if they are in a temp dir that gets destroyed
     # when the previous locator is closed
     import shutil
     thumb_cache = ThumbnailCache.getInstance()
     thumb_cache_dir = thumb_cache.get_directory()
     new_thumbnails = []
     for thumbnail in save_bundle.thumbnails:
         if os.path.dirname(thumbnail) == thumb_cache_dir:
             new_thumbnails.append(thumbnail)
         else:
             cachedir_thumbnail = os.path.join(thumb_cache_dir, os.path.basename(thumbnail))
             try:
                 shutil.copyfile(thumbnail, cachedir_thumbnail)
                 new_thumbnails.append(cachedir_thumbnail)
             except Exception, e:
                 debug.critical('copying %s -> %s failed: %s' % \
                                    (thumbnail, cachedir_thumbnail, str(e)))
Ejemplo n.º 5
0
 def save_as(self, obj):
     klass = obj.__class__
     obj = _DBLocator.save(self, obj, True)
     klass.convert(obj)
     obj.locator = self
     return obj