On Tue, Nov 23, 2010 at 4:38 PM, Maurits van Rees <m.van.rees@zestsoftware.nl> wrote:
After that, the tests for the randomized part still go wrong on Plone 4,
where the same code works in plonenext 3.3.  I guess something has
changed in the LazyCat internals, and the code in the part of the
portlet that does the randomizing depends on those internals, apparently
for speed reasons.  It even has a comment: "Kids, do not try this at
home." :-)
Anyway, as far as I see in this test and when testing it manually in the
browser, the result is that on Plone 4 you never get a result when you
use a randomized collection portlet.

Fixed in http://dev.plone.org/plone/changeset/45917

If someone knows a better way that works in both Plone 3 and 4, and
makes it (apparently) faster again on Plone 4, that would be nice.

I think the P3 and P4 implementations can be merged to the P4 one.

Looking at the commit message for http://dev.plone.org/plone/changeset/21180/plone.portlet.collection/trunk/plone/portlet/collection/collection.py (initial implementation), we can safely assume that this implementation is based on assumption and should be simplified. 
"This LazyMap stuff to avoid instantiating unneeded catalog brains is probably either overkill or should be pushed up the stack.."

Roel Bruggink

Four Digits BV
Willemsplein 44, 6811 KD, Arnhem
tel: +31(0)26 4422700 fax: +31(0)26 7600012
KVK 091621370000 BTW 8161.22.234.B01