[Zope3-Users] Autocreated content objects

Fred Drake fdrake at gmail.com
Tue Sep 26 08:07:41 EDT 2006


On 9/26/06, John Maddison <maddisjohn at gmail.com> wrote:
> Right, that's basically what I want to run, but I can't seem to figure
> out how to have that run at ZODB creation time.  Should I be listening
> for the event that Fred added (thanks!) and run that in the
> subscriber?

There are a couple of ways to go about this with the current codebase:

1) Listen for the IDatabaseOpenedEvent, and make sure you get there
before the default subscriber does.  Add your root before the default
root is created.

2) Listen for the IDatabaseOpenedWithRootEvent, and be willing to
replace the application root.  You need to be sure that you're
replacing it with an object that will support all the things you
expect, since the default is an actual ISite implementation.  (Not
sure just how important that really is, though.  Lots of code will
expect it to be, but hopefully nothing really fundamental.)

My proposed new event is what you really want, since it would only be
triggered when an application root is needed.  But I'd like some
assurance that I'm not the only one who thinks that's the right
approach before I bang out tests and code.


  -Fred

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


More information about the Zope3-users mailing list