예제 #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" %
                     (thumbnail, cachedir_thumbnail), e)
예제 #2
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" % (
                                thumbnail, cachedir_thumbnail),
                                e)
예제 #3
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
예제 #4
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