diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-06-20 22:23:10 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-06-20 22:23:10 +0000 |
commit | 6f77e514d00921bb526546cbda53b39ae1e3cd89 (patch) | |
tree | e32ae76dce925d3d43930b4566b5549b4e64a911 | |
parent | b3a01e552f562cff87da029feeda099faf52d7e0 (diff) | |
download | portage-6f77e514d00921bb526546cbda53b39ae1e3cd89.tar.gz portage-6f77e514d00921bb526546cbda53b39ae1e3cd89.tar.bz2 portage-6f77e514d00921bb526546cbda53b39ae1e3cd89.zip |
Implement get() as part of the standard mapping interface.
svn path=/main/trunk/; revision=3545
-rw-r--r-- | pym/cache/template.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pym/cache/template.py b/pym/cache/template.py index 419ec08a4..7389a142e 100644 --- a/pym/cache/template.py +++ b/pym/cache/template.py @@ -115,6 +115,12 @@ class database(object): def __contains__(self, cpv): return self.has_key(cpv) + def get(self, k, x=None): + try: + return self[k] + except KeyError: + return x + def get_matches(self, match_dict): """generic function for walking the entire cache db, matching restrictions to filter what cpv's are returned. Derived classes should override this if they |