diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-08-28 18:31:22 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-08-28 18:31:22 +0000 |
commit | 67fa34d621b0eedae7d30b9b3840ff29f6ebbaac (patch) | |
tree | 102a58dbd1f43824aa6af5cde68e38d338e1c307 /src/lib | |
parent | db1df7232dfe4f0218d3c30ea43d10bb4f7b16b6 (diff) | |
download | bcfg2-67fa34d621b0eedae7d30b9b3840ff29f6ebbaac.tar.gz bcfg2-67fa34d621b0eedae7d30b9b3840ff29f6ebbaac.tar.bz2 bcfg2-67fa34d621b0eedae7d30b9b3840ff29f6ebbaac.zip |
Fix comments in pkglists with FuzzyDict
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3655 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Plugins/Pkgmgr.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/Server/Plugins/Pkgmgr.py b/src/lib/Server/Plugins/Pkgmgr.py index 7395b7930..27f5b44b1 100644 --- a/src/lib/Server/Plugins/Pkgmgr.py +++ b/src/lib/Server/Plugins/Pkgmgr.py @@ -8,15 +8,19 @@ logger = logging.getLogger('Bcfg2.Plugins.Pkgmgr') class FuzzyDict(dict): fuzzy = re.compile('(?P<name>.*):(?P<alist>\S+(,\S+)*)') def __getitem__(self, key): - mdata = self.fuzzy.match(key) - if mdata: - return dict.__getitem__(self, mdata.groupdict()['name']) + if isinstance(key, str): + mdata = self.fuzzy.match(key) + if mdata: + return dict.__getitem__(self, mdata.groupdict()['name']) + else: + print "got non-string key %s" % str(key) return dict.__getitem__(self, key) def has_key(self, key): - mdata = self.fuzzy.match(key) - if self.fuzzy.match(key): - return dict.has_key(self, mdata.groupdict()['name']) + if isinstance(key, str): + mdata = self.fuzzy.match(key) + if self.fuzzy.match(key): + return dict.has_key(self, mdata.groupdict()['name']) return dict.has_key(self, key) def get(self, key, default=None): |