On 9/25/06, Philipp von Weitershausen <[EMAIL PROTECTED]> wrote:
Yeah, like Stephan says, Zope should probably send an
IObjectCreatedEvent there. In the mean time, you can hook into
IDatabaseOpenedEvent which gets sent every time Zope starts up and opens
a connection to the ZODB.

I've fixed the trunk so that an IObjectCreatedEvent is generated when
the root folder is created.

The IDatabaseOpenedEvent certainly could be used to establish an
alternate application root, but the ordering of the events is a
problem (predictable, but that's somewhat fragile); it's not
completely obvious how to get your subscriber called before the
default subscriber.

I'd like to suggest that a new event be fired by the default
subscriber if there isn't already an application root.  Currently, a
separate event is fired when the database is opened and the presence
of an application root has been established
(IDatabaseOpenedWithRootEvent).  A separate event could be fired
before the root is created and added
(IDatabaseOpenedWithoutRootEvent); this should provide the same
information as the IDatabaseOpenedEvent, plus the name of the key that
is expected to hold the root object.  A subscriber can use that event
to add the application root (and anything else).  After the event is
processed, the default subscriber can check again for the root; if it
still doesn't exist, the current creation code can be used to create
the root folder.

This should make it a lot easier to use alternate root objects,
something it sounds like many of us have run up against.


Fred L. Drake, Jr.    <fdrake at gmail.com>
"Every sin is the result of a collaboration." --Lucius Annaeus Seneca
Zope3-users mailing list

Reply via email to