diff options
author | 2015-07-13 09:25:36 -0400 | |
---|---|---|
committer | 2015-07-13 09:25:39 -0400 | |
commit | a3ef79ecdc93c82a599cab3eef1be49d7ca40a9d (patch) | |
tree | 8633cdb64877262f9fe4f57964e0d4da1f334394 | |
parent | overlay.py: Quick code cleanup (diff) | |
download | layman-a3ef79ecdc93c82a599cab3eef1be49d7ca40a9d.tar.gz layman-a3ef79ecdc93c82a599cab3eef1be49d7ca40a9d.tar.bz2 layman-a3ef79ecdc93c82a599cab3eef1be49d7ca40a9d.zip |
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.
-rw-r--r-- | layman/dbbase.py | 11 | ||||
-rw-r--r-- | 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) |