cache/volatile: fix __iter__ and __contains__
authorZac Medico <zmedico@gentoo.org>
Wed, 7 Sep 2011 15:56:15 +0000 (08:56 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 7 Sep 2011 15:56:15 +0000 (08:56 -0700)
Special methods can't be assigned in the constructor.

pym/portage/cache/volatile.py

index 0bf6bab2c7f41b40f250568e2481ded87a9ea163..18049dddb3f1e34a7602c2ab038031186de4fa4d 100644 (file)
@@ -14,12 +14,16 @@ class database(template.database):
                config.pop("perms", None)
                super(database, self).__init__(*args, **config)
                self._data = {}
-               self.__iter__ = self._data.__iter__
                self._delitem = self._data.__delitem__
-               self.__contains__ = self._data.__contains__
 
        def _setitem(self, name, values):
                self._data[name] = copy.deepcopy(values)
 
        def _getitem(self, cpv):
                return copy.deepcopy(self._data[cpv])
+
+       def __iter__(self):
+               return iter(self._data)
+
+       def __contains__(self, key):
+               return key in self._data