From 6f77e514d00921bb526546cbda53b39ae1e3cd89 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 20 Jun 2006 22:23:10 +0000 Subject: [PATCH] Implement get() as part of the standard mapping interface. svn path=/main/trunk/; revision=3545 --- pym/cache/template.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.26.2