[Zope-CMF] Workflow's 'notifyCreated' message gets sent to wrong workflow
Jeffrey P Shell
jeffrey@cuemedia.com
Wed, 14 Nov 2001 19:41:04 -0700
http://www.zope.org/Products/PTK/Tracker/410/1
I made a custom workflow object in Python and it's been going
pretty well - until I noticed that its 'notifyCreated()' method
never gets called.
After tracing through the creation process, I noticed that
notifyCreated is called in 'PortalContent#manage_afterAdd()', which
is called from 'OFS#_setObject()' which is usually called in the
factory method defined for the object, unless the objects Meta type
and target Portal Type happen to line up.
This occurs BEFORE _setPortalTypeName() is called on the object,
leaving it free-floating from its workflow (or anything else that's
Type-dependant) during the manage_afterAdd() process.
Thus, the permission/role mappings I had set up for my content
object's initial state never get set, exposing actions to people I
hadn't intended on.
I imagine that most of what's in PortalContent#manage_afterAdd()
could be moved into constructInstance, or a CMF equivilent of
'manage_afterAdd()' such as 'afterConstruction' could be put into
the basic PortalContent API, with the intention that it gets called
at the end of constructInstance after the PortalType information
has been set.
Jeffrey P Shell, jeffrey@cuemedia.com