Hi folks,
I posted the following patch to Zope-Dev.
It fixes a bad interaction between some ZCatalog queries and dtml-in.
Sometimes, dtml-in only iterates through a part of the results.
The problem is that Catalog.py is giving a LazyCat instance the wrong
length for a concatenation of sequences; it is giving the number of
sequences rather than the sum of the lengths of the sequences.
Can I just check this in, or do I need to get approval from the owner of
the ZCatalog package?
*** lib/python/Products/ZCatalog/Catalog.py.original
--- lib/python/Products/ZCatalog/Catalog.py.patched
***************
*** 673,679 ****
if (type(so) is type('') and
lower(so) in ('reverse', 'descending')):
r.reverse()
! r=LazyCat(map(lambda i: i[1], r), len(r))
return r
--- 673,681 ----
if (type(so) is type('') and
lower(so) in ('reverse', 'descending')):
r.reverse()
! r=map(lambda i: i[1], r)
! r=LazyCat(r, reduce(lambda x,y: x+len(y), r, 0))
!
return r
--
Steve Alexander
Software Engineer
Cat-Box limited
I posted the following patch to Zope-Dev.
It fixes a bad interaction between some ZCatalog queries and dtml-in.
Sometimes, dtml-in only iterates through a part of the results.
The problem is that Catalog.py is giving a LazyCat instance the wrong
length for a concatenation of sequences; it is giving the number of
sequences rather than the sum of the lengths of the sequences.
Can I just check this in, or do I need to get approval from the owner of
the ZCatalog package?
*** lib/python/Products/ZCatalog/Catalog.py.original
--- lib/python/Products/ZCatalog/Catalog.py.patched
***************
*** 673,679 ****
if (type(so) is type('') and
lower(so) in ('reverse', 'descending')):
r.reverse()
! r=LazyCat(map(lambda i: i[1], r), len(r))
return r
--- 673,681 ----
if (type(so) is type('') and
lower(so) in ('reverse', 'descending')):
r.reverse()
! r=map(lambda i: i[1], r)
! r=LazyCat(r, reduce(lambda x,y: x+len(y), r, 0))
!
return r
--
Steve Alexander
Software Engineer
Cat-Box limited