summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-06-20 22:23:10 +0000
committerZac Medico <zmedico@gentoo.org>2006-06-20 22:23:10 +0000
commit6f77e514d00921bb526546cbda53b39ae1e3cd89 (patch)
treee32ae76dce925d3d43930b4566b5549b4e64a911
parentb3a01e552f562cff87da029feeda099faf52d7e0 (diff)
downloadportage-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.py6
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