def __init__ (self, name=None, *args, **kwargs): #Setup the primary session storage. self.database_path = self._determine_database_path(name) FileStorage, Connection = misc.import_durus() self.store = FileStorage(self.database_path) self.connection = Connection(self.store) self.storage_lock = threading.RLock() logging.debug("%s: Creating primary session storage." % name) self.storage = self.connection.get_root() self.storage['_updated'] = misc.GetTickCount() self.storage['name'] = name self.migrate() if not hasattr(self, "interval"): self.interval = self.syncInterval if not hasattr(self, "idle"): self.idle = self.syncIdle self.timer = None self.updater(True) super(Storage, self).__init__(name=name, *args, **kwargs)
def load_file(self, filename): output.speak(_("Loading file...")) FileStorage, Connection = misc.import_durus() self.file = FileStorage(paths.data_path(filename)) self.connection = Connection(self.file) self.root = self.connection.root