diff options
author | 2015-07-15 11:54:28 -0400 | |
---|---|---|
committer | 2015-07-15 11:54:28 -0400 | |
commit | 57848c6abf1a43a9df8efcefc4cbe2297d4ecac4 (patch) | |
tree | 54d1fd34544169479cf371f4d0da50bc76ed4fbc | |
parent | overlay.py: Adds better error handling for missing "source" entries (diff) | |
download | layman-57848c6abf1a43a9df8efcefc4cbe2297d4ecac4.tar.gz layman-57848c6abf1a43a9df8efcefc4cbe2297d4ecac4.tar.bz2 layman-57848c6abf1a43a9df8efcefc4cbe2297d4ecac4.zip |
dbbase.py: Optimizes if check for db_type
-rw-r--r-- | layman/dbbase.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/layman/dbbase.py b/layman/dbbase.py index 0bdd4e9..283d65c 100644 --- a/layman/dbbase.py +++ b/layman/dbbase.py @@ -179,10 +179,10 @@ class DbBase(object): ''' Read the overlay database for installed overlay definitions. ''' + db_type = self.db_type + if text and text_type: db_type = text_type - else: - db_type = self.db_type #Added to keep xml functionality for cached overlay XML definitions if 'cache' in path and '.xml' in path: @@ -197,11 +197,16 @@ class DbBase(object): db_ctl.read_db(path, text=text) - def write(self, path): + def write(self, path, migrate_type=None): ''' Write the list of overlays to a file. ''' - db_ctl = self.mod_ctl.get_class(self.db_type)(self.config, + db_type = self.db_type + + if migrate_type: + db_type = migrate_type + + db_ctl = self.mod_ctl.get_class(db_type)(self.config, self.overlays, self.paths, self.ignore, |