projects
/
portage.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b3a01e5
)
Implement get() as part of the standard mapping interface.
author
Zac Medico
<zmedico@gentoo.org>
Tue, 20 Jun 2006 22:23:10 +0000
(22:23 -0000)
committer
Zac Medico
<zmedico@gentoo.org>
Tue, 20 Jun 2006 22:23:10 +0000
(22:23 -0000)
svn path=/main/trunk/; revision=3545
pym/cache/template.py
patch
|
blob
|
history
diff --git
a/pym/cache/template.py
b/pym/cache/template.py
index 419ec08a403dfbfe5d6a0c76d1dbe9ddad959895..7389a142e6a9621d270da8db98b3d4dd77b78f39 100644
(file)
--- 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