From a3ef79ecdc93c82a599cab3eef1be49d7ca40a9d Mon Sep 17 00:00:00 2001 From: Devan Franchini Date: Mon, 13 Jul 2015 09:25:36 -0400 Subject: Adds switch on read_db if text is provided Logically speaking, if the database "document" text is provided then it will likely not be universal to every database provided. Therefore adding another parameter that specifies the type of text that is being provided will help distinguish which database type it is. --- layman/dbbase.py | 11 ++++++++--- layman/remotedb.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/layman/dbbase.py b/layman/dbbase.py index 56ef158..09133c2 100644 --- a/layman/dbbase.py +++ b/layman/dbbase.py @@ -167,12 +167,17 @@ class DbBase(object): return - def read_db(self, path, text=None): + def read_db(self, path, text=None, text_type=None): ''' Read the overlay database for installed overlay definitions. ''' - for types in self.db_types: - db_ctl = self.mod_ctl.get_class(types)(self.config, + if text and text_type: + types = [text_type] + else: + types = self.db_types + + for t in types: + db_ctl = self.mod_ctl.get_class(t)(self.config, self.overlays, self.paths, self.ignore, diff --git a/layman/remotedb.py b/layman/remotedb.py index cd6ece3..89caf7a 100644 --- a/layman/remotedb.py +++ b/layman/remotedb.py @@ -280,7 +280,7 @@ class RemoteDB(DbBase): def _check_download(self, olist, url): try: - self.read_db(url, text=olist) + self.read_db(url, text=olist, text_type="xml_db") except Exception as error: self.output.debug("RemoteDB._check_download(), url=%s \nolist:\n" % url,2) -- cgit v1.2.3