On Wed, 2006-09-27 at 11:13 +1000, John Maddison wrote:

> > Ah, I think I may have misdescribed what I was trying to do - I'm not
> > trying to replace the root object, I'm trying to automatically create
> > some other objects to put inside it (without having to use the ZMI).

Hi John,

Maybe we are back at my answer? There is zc.buildout for full
installation set up and z3c.configurator, neither of which I've gained
experience with - yet. They are still a rung or two up my learning
curve. (Mixing metaphors).

For my simple attempts I use a straight forward python method::

class AddSampleGallery(BrowserView):
    """Install script for a sample gallery"""

    def install(self):

        root = self.context
        root['myapp'] = MyApp()

And slot it in a menu with zcml::

  <browser:page
      for="zope.app.folder.interfaces.IFolder"
      name="addSampleGallery.html"
      permission="zope.ManageSite"
      class=".install.AddSampleGallery"
      attribute="install"
      />

  <browser:menuItem
      menu="zmi_actions" title="Add sample gallery"
      for="zope.app.folder.interfaces.IFolder"
      action="addSampleGallery.html"
      permission="zope.ManageSite"
      />

The install method obviously does a lot more including sample content,
principals etc. And then there is a subscriber to the application's
IObjectAddedEvent which does set up only possible after the content is
located.

Regards,
Darryl

> _______________________________________________
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to