class DatabaseManager(object): """This class is used to import/export the paella database """ def __init__(self, conn): self.cfg = PaellaConfig() self.conn = conn default_path = path(self.cfg.get("database", "default_path")).expand() self.import_dir = default_path self.export_dir = default_path # self.importer = PaellaProcessor(self.conn, self.cfg) # self.exporter = PaellaDatabase(self.conn, '/') self.exporter = PaellaExporter(self.conn) self.importer = PaellaImporter(self.conn) def export_all(self, path): self.exporter.perform_full_export(path) def import_all(self, dirname): self.importer.perform_full_import(dirname) def restore(self, path): if not os.path.isdir(path): raise Error, "argument needs to be a directory" dbpath = os.path.join(path, "database.xml") mdbpath = os.path.join(path, "machine_database.xml") pp = PaellaProcessor(self.conn, self.cfg) pp.create(dbpath)
class DatabaseManager(object): """This class is used to import/export the paella database """ def __init__(self, conn): self.cfg = PaellaConfig() self.conn = conn default_path = path(self.cfg.get('database', 'default_path')).expand() self.import_dir = default_path self.export_dir = default_path #self.importer = PaellaProcessor(self.conn, self.cfg) #self.exporter = PaellaDatabase(self.conn, '/') self.exporter = PaellaExporter(self.conn) self.importer = PaellaImporter(self.conn) def export_all(self, path): self.exporter.perform_full_export(path) def import_all(self, dirname): self.importer.perform_full_import(dirname) def restore(self, path): if not os.path.isdir(path): raise Error, 'argument needs to be a directory' dbpath = os.path.join(path, 'database.xml') mdbpath = os.path.join(path, 'machine_database.xml') pp = PaellaProcessor(self.conn, self.cfg) pp.create(dbpath)
class DatabaseManager(object): """This class is used to import/export the paella database """ def __init__(self, conn): self.cfg = PaellaConfig() self.conn = conn default_path = path(self.cfg.get('database', 'default_path')).expand() self.import_dir = default_path self.export_dir = default_path self.exporter = PaellaExporter(self.conn) self.importer = PaellaImporter(self.conn) def export_all(self, dirname): self.exporter.perform_full_export(dirname) def import_all(self, dirname): self.importer.perform_full_import(dirname)
class DatabaseManager(object): def __init__(self, conn): object.__init__(self) self.cfg = PaellaConfig() self.conn = conn self.import_dir = self.cfg.get('database', 'import_path') self.export_dir = self.cfg.get('database', 'export_path') def backup(self, path): if not os.path.isdir(path): raise Error, 'arguement needs to be a directory' pdb = PaellaDatabase(self.conn, path) pdb.backup(path) mh = MachineHandler(self.conn) mh.export_machine_database(path) def restore(self, path): if not os.path.isdir(path): raise Error, 'arguement needs to be a directory' dbpath = join(path, 'database.xml') mdbpath = join(path, 'machine_database.xml') pp = PaellaProcessor(self.conn, self.cfg) pp.create(dbpath)