Implement config.has_key() on top of __contains__ instead of vice versa.
authorZac Medico <zmedico@gentoo.org>
Thu, 21 Jun 2007 20:15:10 +0000 (20:15 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 21 Jun 2007 20:15:10 +0000 (20:15 -0000)
svn path=/main/trunk/; revision=6916

pym/portage/__init__.py

index 6e2d3878116f9b9872743fa246a2462a6ad461b7..d6afb9d9ddf39ceb918147df7741df6a8882bf2f 100644 (file)
@@ -2202,14 +2202,14 @@ class config(object):
                return match
 
        def has_key(self,mykey):
-               for x in self.lookuplist:
-                       if x.has_key(mykey):
-                               return 1
-               return 0
+               return mykey in self
 
        def __contains__(self, mykey):
                """Called to implement membership test operators (in and not in)."""
-               return bool(self.has_key(mykey))
+               for d in self.lookuplist:
+                       if mykey in d:
+                               return True
+               return False
 
        def setdefault(self, k, x=None):
                if k in self: