[Zope-CMF] Re: [dev] newstyle content creation
Martin Aspeli
optilude at gmx.net
Tue Apr 22 17:54:28 EDT 2008
Hi Yuppie,
> Implementing newstyle content factories[1] and using events for content
> creation[2] made it much easier to create content without using
> invokeFactory and friends.
Indeed!
> These steps are still necessary:
>
> - check portal_type exists (*)
> - check allowType(portal_type) for the container (*)
> - get factory name for portal_type (*)
> - get IFactory utility for the factory name
> - use factory for creating an object
> - set object's portal_type (*)
> - set other object attributes if necessary
> - send ObjectCreatedEvent
> - add the object to the container using _setObject
>
> The steps marked with (*) are CMF specific.
Yep.
> Today I checked in a formlib based add view for File objects[3].
Have you looked at z3c.form at all? There's a package called
plone.z3cform that provides Zope 2 integration for this (it shouldn't be
Plone specific beyond that). I'm only asking since people seem to be
going in this direction.
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
More information about the Zope-CMF
mailing list