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

Matt Hamilton wrote:
> I really don't understand this code, so maybe I'm missing something here, but
> anyone know wtf the opaqueItem code does in CMFCore.CMFCatalogAware?!

It allows propagating IObjectEvents to nested objects not findable via
the normal "content items" interface:  the one example in the CMF is the
'talkback' attribute which holds DiscussionItems for an object.

> Why does the opaqueItems method iterate through *every* attribute in the root 
> of
> the site causing all objects (including, at least in plone) all sub-objects of
> folders to be woken up too):
> 
>     for name in self_base.__dict__.keys():
>             obj = getattr(self, name)
>             if ICallableOpaqueItem.providedBy(obj) \
>                     or z2ICallableOpaqueItem.isImplementedBy(obj):
>                 items.append((obj.getId(), obj))
> 
> If it is looking for opaque items (I still don't know what these really are)
> then why does it look in content objects too?!

The 'opaqueItems' method in CMFCatalogAware is called only by the
'opaqueIds' and 'opaqueValues' methods in the same class.  The
'opaqueIds' method is never called in stock CMF at all.  The
'opaqueValues' method is called by the event subscriber which dispatches
IObjectEvents.

> How about the changes below?
> 
>     objectids = dict([(x,1) for x in self.objectIds()])                       
>  
>          
>     for name in self_base.__dict__.keys():
>         if name not in objectids:                                             
>  
>          
>             obj = getattr(self, name)
>             if ICallableOpaqueItem.providedBy(obj) \
>                     or z2ICallableOpaqueItem.isImplementedBy(obj):
>                 items.append((obj.getId(), obj))
> 
> (that was probably all wrapped to hell)
> 
> Basically, I've got a production site which loads up several tens of thousands
> of objects from the ZODB just to display the front page.  Madness.

AFAIK, that stuff should have no impact on rendering the front page of
your site:  the event handler should only be triggered on IObjectEvents
emitted for an object, which will typically only be on writes.  You
wouldn't be doing a write-on-read for every rendering of the homepage,
would you?  If so, you have way worse problems than this bit of code.



Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJTLZZ+gerLs4ltQ4RAqNzAJwL2O6RpIkyKxTBKoGWQHlEnf4CaQCgngOG
GrgKYfmdvTC/Jlz4oxuQ40s=
=66GV
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Reply via email to