Implement FetchlistDict.__len__, in order to avoid
authorZac Medico <zmedico@gentoo.org>
Mon, 12 Oct 2009 22:59:32 +0000 (22:59 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 12 Oct 2009 22:59:32 +0000 (22:59 -0000)
infinite recursion in some cases.

svn path=/main/trunk/; revision=14597

pym/portage/__init__.py

index 299615c4f4f925b2f50994979ec82ac270fe18dc..fdde3e6d344fda44ebab824b11f724e90f0ba70a 100644 (file)
@@ -8611,6 +8611,11 @@ class FetchlistDict(portage.cache.mappings.Mapping):
        def __iter__(self):
                return iter(self.portdb.cp_list(self.cp, mytree=self.mytree))
 
+       def __len__(self):
+               """This needs to be implemented in order to avoid
+               infinite recursion in some cases."""
+               return len(self.portdb.cp_list(self.cp, mytree=self.mytree))
+
        def keys(self):
                """Returns keys for all packages within pkgdir"""
                return self.portdb.cp_list(self.cp, mytree=self.mytree)