Hash: SHA1


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

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

See the issue at:

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:[EMAIL PROTECTED] ]

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

Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to