* [gentoo-commits] proj/layman:master commit in: layman/db_modules/xml/, layman/
@ 2015-07-09 17:00 Devan Franchini
0 siblings, 0 replies; only message in thread
From: Devan Franchini @ 2015-07-09 17:00 UTC (permalink / raw
To: gentoo-commits
commit: 47349f8b5ef3012c915ff8ad7825caefde103891
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 9 16:59:57 2015 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Jul 9 16:59:59 2015 +0000
URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=47349f8b
dbbase.py: Modifies read_db function to allow for passing a text parameter
This was done to allow for only one read*() function and add
compatibility with the way read() was originally set up.
xml.py: read_db() is also modified in this file for the same purpose.
remotedb.py: changes the calling of self.read() to self.read_db().
layman/db_modules/xml/xml.py | 17 ++++++++++-------
layman/dbbase.py | 4 ++--
layman/remotedb.py | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/layman/db_modules/xml/xml.py b/layman/db_modules/xml/xml.py
index 189e868..c444fc3 100644
--- a/layman/db_modules/xml/xml.py
+++ b/layman/db_modules/xml/xml.py
@@ -107,16 +107,19 @@ class DBHandler(object):
raise NotImplementedError(msg)
- def read_db(self, path):
+ def read_db(self, path, text=None):
'''
Read the overlay definition file.
'''
- try:
- with fileopen(path, 'r') as df:
- document = df.read()
- except Exception as error:
- if not self.ignore_init_read_errors:
- msg = 'XML DBHandler - Failed to read the overlay list at'\
+ document = text
+
+ if not document:
+ try:
+ with fileopen(path, 'r') as df:
+ document = df.read()
+ except Exception as error:
+ if not self.ignore_init_read_errors:
+ msg = 'XML DBHandler - Failed to read the overlay list at'\
'("%(path)s")' % {'path': path}
self.output.error(msg)
raise error
diff --git a/layman/dbbase.py b/layman/dbbase.py
index b6c32bc..56ef158 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -167,7 +167,7 @@ class DbBase(object):
return
- def read_db(self, path):
+ def read_db(self, path, text=None):
'''
Read the overlay database for installed overlay definitions.
'''
@@ -178,7 +178,7 @@ class DbBase(object):
self.ignore,
self.ignore_init_read_errors)
- db_ctl.read_db(path)
+ db_ctl.read_db(path, text=text)
def write(self, path):
diff --git a/layman/remotedb.py b/layman/remotedb.py
index e6492f4..cd6ece3 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(olist, origin=url)
+ self.read_db(url, text=olist)
except Exception as error:
self.output.debug("RemoteDB._check_download(), url=%s \nolist:\n"
% url,2)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-09 17:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-09 17:00 [gentoo-commits] proj/layman:master commit in: layman/db_modules/xml/, layman/ Devan Franchini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox