Example #1
0
 def __init__(self,
              host,
              port,
              database,
              user,
              passwd,
              name=None,
              **kwargs):
     _DBLocator.__init__(self, host, port, database, user, passwd, name,
                         **kwargs)
     self.__list = ExtConnectionList.getInstance(default_connections_file())
     self.ext_connection_id = -1
Example #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)
Example #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
Example #4
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)
Example #5
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
Example #6
0
 def load(self, klass=None):
     from vistrails.core.vistrail.vistrail import Vistrail
     if klass is None:
         klass = Vistrail
     save_bundle = _DBLocator.load(self, klass.vtType, ThumbnailCache.getInstance().get_directory())
     if klass.vtType == DBWorkflow.vtType:
         wf = save_bundle
         klass = self.get_convert_klass(wf.vtType)
         klass.convert(wf)
         wf.locator = self
         return wf
     for obj in save_bundle.get_db_objs():
         klass = self.get_convert_klass(obj.vtType)
         klass.convert(obj)
         obj.locator = self
     return save_bundle
Example #7
0
 def load(self, klass=None):
     from vistrails.core.vistrail.vistrail import Vistrail
     if klass is None:
         klass = Vistrail
     save_bundle = _DBLocator.load(
         self, klass.vtType,
         ThumbnailCache.getInstance().get_directory())
     if klass.vtType == DBWorkflow.vtType:
         wf = save_bundle
         klass = self.get_convert_klass(wf.vtType)
         klass.convert(wf)
         wf.locator = self
         return wf
     for obj in save_bundle.get_db_objs():
         klass = self.get_convert_klass(obj.vtType)
         klass.convert(obj)
         obj.locator = self
     return save_bundle
Example #8
0
 def from_xml(node, include_name=False):
     locator = _DBLocator.from_xml(node, include_name)
     locator.__class__ = DBLocator
     return locator
Example #9
0
 def from_xml(node, include_name=False):
     locator = _DBLocator.from_xml(node, include_name)
     locator.__class__ = DBLocator
     return locator
Example #10
0
 def __init__(self, host, port, database, user, passwd, name=None,
              **kwargs):
     _DBLocator.__init__(self, host, port, database, user, passwd, name,
                         **kwargs)
     self.__list = ExtConnectionList.getInstance(default_connections_file())
     self.ext_connection_id = -1