From ba5212b0841e088a69e9de6680cc468be3a94452 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 21 Jun 2006 04:14:34 +0000 Subject: [PATCH] Implement get() as part of the standard mapping interface. This patch is from trunk r3545. svn path=/main/branches/2.1/; revision=3580 --- pym/cache/template.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pym/cache/template.py b/pym/cache/template.py index 097ebed8d..43f3c8a14 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