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.


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.


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.


Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to