[Zope-CMF] [dev] newstyle content creation
yuppie
y.2008 at wcm-solutions.de
Tue Apr 22 08:27:29 EDT 2008
Hi!
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]. There
is a new "Add File" action available if you use the "Experimental
CMFDefault Browser Views" extension profile.
Any feedback is welcome. Not sure if this makes Bug #161664[4] obsolete.
Cheers,
Yuppie
[1] http://mail.zope.org/pipermail/zope-cmf/2006-May/024464.html
[2] http://mail.zope.org/pipermail/zope-cmf/2007-December/027000.html
[3] http://svn.zope.org/?rev=85591&view=rev
[4] https://bugs.launchpad.net/zope-cmf/+bug/161664
More information about the Zope-CMF
mailing list