summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-03-16 09:37:59 +0000
committerZac Medico <zmedico@gentoo.org>2006-03-16 09:37:59 +0000
commit071ac2deaf3804cc9a0720cfa6f7532f831a7762 (patch)
treea60c2d55caa9e5029aa7c9492d6e3e33eaa2c823
parentf73f7adf494fcae968c76a754dc1c56294b1293a (diff)
downloadportage-071ac2deaf3804cc9a0720cfa6f7532f831a7762.tar.gz
portage-071ac2deaf3804cc9a0720cfa6f7532f831a7762.tar.bz2
portage-071ac2deaf3804cc9a0720cfa6f7532f831a7762.zip
Implement __contains__ for portage.config so that it calls has_key, enabling membership test operators (in and not in) to work as expected.
svn path=/main/trunk/; revision=2907
-rw-r--r--pym/portage.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py
index cf76952d0..00f0822ae 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -1576,6 +1576,12 @@ class config:
return 1
return 0
+ def __contains__(self, mykey):
+ """Called to implement membership test operators (in and not in)."""
+ if self.has_key(mykey):
+ return True
+ return False
+
def keys(self):
mykeys=[]
for x in self.lookuplist: