Implement __contains__ for portage.config so that it calls has_key, enabling membersh...
authorZac Medico <zmedico@gentoo.org>
Thu, 16 Mar 2006 09:37:59 +0000 (09:37 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 16 Mar 2006 09:37:59 +0000 (09:37 -0000)
svn path=/main/trunk/; revision=2907

pym/portage.py

index cf76952d056ea0c904e1a08aa86e63c2280e50a0..00f0822ae03044b9622a75a7d7a8ceb95fe76068 100644 (file)
@@ -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: