commit:     57848c6abf1a43a9df8efcefc4cbe2297d4ecac4
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 15 15:54:28 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed Jul 15 15:54:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=57848c6a

dbbase.py: Optimizes if check for db_type

 layman/dbbase.py | 13 +++++++++----
 1 file 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,

Reply via email to