[Zope3-Users] Autocreated content objects
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Sep 25 05:02:10 EDT 2006
On Monday 25 September 2006 03:21, John Maddison wrote:
> Is it possible/wise to "auto-create" content objects in the ZODB? Say I'm
> creating a blog application and have a container type(BlogContainer) and
> want an instance called "blog" in the root of the ZODB. Is it possible to
> programatically specify this, or is my only option to create it through the
> ZMI? I thought that perhaps an event was generated when the root object was
> created that I could hook into, but it seems not. Perhaps I'm looking at
> this the wrong way - would "fixtures" like this be better implemented as
> utilities with z3c.traverser redirecting to appropriate views?
It is very much a goal of Zope 3 to allow Python-based content adding; in
fact, I am never adding content via ZMI these days. The closest I get to the
ZMI is the Sample Data generator that creates a full application for me. By
the way, much thanks to SchoolTool, Roger and Juergen who have developed this
concept. We also use the configurator to configure complex content objects.
So to answer your specific question: There is an event fired when the database
is opened with the root. See zope.app.appsetup.bootstrap, line 193. Hoever, I
agree that an created and add event should be created for the root folder in
the same function. Could you file a bug report, or even better provide a fix
with test? :-)
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
More information about the Zope3-users
mailing list