[Zope-dev] Catalog performance

Chris Withers chrisw at nipltd.com
Fri Sep 12 13:24:37 EDT 2003


John Barratt wrote:
> Chris Withers wrote:
> 
>> John Barratt wrote:
>>
>>> docs = container.portal_catalog(meta_type='Document', ...)
>>> for doc in docs:
>>>     obj = doc.aq_parent.unrestrictedTraverse(doc.getPath())
>>>     was_ghost = obj._p_changed is None
>>>     value = obj.attr
>>>     if was_ghost:obj._p_deactivate()
>>
>> Bear in mind though, that you can only do this in an external method...

..or product code ;-)

> Why can you only do this in an external method?  This idea (deactivating 
> objects) is used quite a extensively in many parts of core zope such as 
> OFS.ObjectManager as I mentioned in another post, and we use it in our 
> product code quite a bit as well.

Nguyen was asking about a python script, you can't do these things there as the 
necessary methods don't have security declarations, and the methods start with 
'_', which I think the Zope Security Policy denies access to...

Chris




More information about the Zope-Dev mailing list