[Zope3-Users] Re: Autocreated content objects

Volker Bachschneider vbachs at dzug.org
Mon Sep 25 12:55:11 EDT 2006


Philipp von Weitershausen schrieb:
> John Maddison wrote:
>> Is it possible/wise to "auto-create" content objects in the ZODB?  Say 

> 
> Yeah, like Stephan says, Zope should probably send an 
> IObjectCreatedEvent there. In the mean time, you can hook into 

That works fine to me, but:

import transaction
from zope.app.myproject.person import Person
from zope.event import notify
from zope.livecycleevent import ObjectCreatedEvent
obj = app.root()['005'] = Person()
obj.nnam = u'Karlson'
notify(ObjectCreatedEvent(obj))
transaction.commit()

creates a perfect object with timestamp in the ZODB. But the IntId / 
Catalog do not recognizes the object. On the other hand, an object 
manual created via zmi and programatically modified via Script (with 
event ObjectModifiedEvent) is noticed and can be reindexed. Objects 
created only via zmi are recognizes and indexed. I think i have to fire 
up an IntIdAddedEvent but do not how.

Volker


More information about the Zope3-users mailing list