From: Zac Medico Date: Tue, 20 Jun 2006 22:23:10 +0000 (-0000) Subject: Implement get() as part of the standard mapping interface. X-Git-Tag: v2.1.1~455 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6f77e514d00921bb526546cbda53b39ae1e3cd89;p=portage.git Implement get() as part of the standard mapping interface. svn path=/main/trunk/; revision=3545 --- 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