[Zope-dev] Zope Collector issue #1384

Simon Eisenmann simon at struktur.de
Fri Jun 25 05:13:14 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I just submitted issue #1384 to zope.org's collector but got this error
message:
Email notice error: '(110, 'Connection timed out')'

Therefore i send the note of this collector issue to the dev list.

See the issue at:
http://zope.org/Collectors/Zope/1384


Cheers,
~ Simon


*** snip ***
len(LazyCat) doesnt work when tried to read more elements as in the
LazyCat before:

~From time to time we had some problems with doing Zcatalog based OR
searches. To do this we simply add one catalog result to the other. An
addition of LazyMap's produces a LazyCat object. In some conditions our
application raised "AttributeError: LazyCat instance has no attribute
'_seq'". Today i looked into this in detail and found the problem in the
LazyCat implementation.

So the problem is that when you iterate over more LazyCat list elements
that there are actually in the list an IndexError is raised. This is
fine of course. But afterwards you are no longer able to get the length
of this LazyCat, because the error above is raised. You need to read the
length of a LazyCat _before_ you have code which probably could raise an
IndexError of this list.

To test this behavior use the following script on a ZCatalog:
"""
catalog = context.portal_catalog

res1 = catalog(SearchableText="admin")
res2 = catalog(SearchableText="icoya")

res = res1 + res2

for x in range(6):
~    try: print "x", x, res[x]
~    except: pass

print "len", len(res)

return printed
"""

In this case the real length of the res LazyCat is 5 .. so i iterate to
6 which raises an IndexError. Afterwards it's no longer possible to
retrieve the length of this (now borked) LazyCat. If i had read the
length before the iteration, all works perfectly, since the
implementation "remembers" the len if it was computed once.


So if this is to be fixed then the implementation of the LazyCat length
method has to be changed slightly to check for the missing _seq
attribute and then use the self._data for length retrieval.

*** snip ***


- --

Simon Eisenmann

[ mailto:simon at struktur.de ]

[ struktur AG | Junghansstraße 5 | 70469 Stuttgart ]
[ T. +49.711.896656.68 | F.+49.711.89665610 ]
[ http://www.struktur.de | mailto:info at struktur.de ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA2+yqcKXkdvrBGTARAnZYAKCinwA7HLamr0ZTzVQNgi8oCpkh+QCeK31k
zqaOTHEqiUN9D8hYxgq4AwM=
=kEId
-----END PGP SIGNATURE-----


More information about the Zope-Dev mailing list