1 |
commit: f55f1714c7e2855ca4cbb45f9d8ae6cee126af17 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 7 15:56:15 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 7 15:56:15 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f55f1714 |
7 |
|
8 |
cache/volatile: fix __iter__ and __contains__ |
9 |
|
10 |
Special methods can't be assigned in the constructor. |
11 |
|
12 |
--- |
13 |
pym/portage/cache/volatile.py | 8 ++++++-- |
14 |
1 files changed, 6 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/pym/portage/cache/volatile.py b/pym/portage/cache/volatile.py |
17 |
index 0bf6bab..18049dd 100644 |
18 |
--- a/pym/portage/cache/volatile.py |
19 |
+++ b/pym/portage/cache/volatile.py |
20 |
@@ -14,12 +14,16 @@ class database(template.database): |
21 |
config.pop("perms", None) |
22 |
super(database, self).__init__(*args, **config) |
23 |
self._data = {} |
24 |
- self.__iter__ = self._data.__iter__ |
25 |
self._delitem = self._data.__delitem__ |
26 |
- self.__contains__ = self._data.__contains__ |
27 |
|
28 |
def _setitem(self, name, values): |
29 |
self._data[name] = copy.deepcopy(values) |
30 |
|
31 |
def _getitem(self, cpv): |
32 |
return copy.deepcopy(self._data[cpv]) |
33 |
+ |
34 |
+ def __iter__(self): |
35 |
+ return iter(self._data) |
36 |
+ |
37 |
+ def __contains__(self, key): |
38 |
+ return key in self._data |