[Zope-CMF] DefaultWorkflow.py -- how do I extend this?

seb bacon seb@jamkit.com
Thu, 3 May 2001 11:46:38 +0100


* alan runyan <runyaga@thisbox.com> [010503 09:40]:
> 2. I would like to get a hold of the Portal root (how?) I would imagine it
> would be something simple like using my aq_parent and ask it where is the
> nearest Portal Root -- I would rather ask an object and not rely on
> acquisition.

you could get it like this, since all the tools are in the portal root
(untested): 

  wt = getToolByName('portal_workflow')
  portal = aq_parent(aq_inner(wt))

> 4. now I want to get to a subfolder in the Portal called MyNewFolder,
> getPhysicalRoot()['Portal.MyNewFolder'] doesnt work -- it seems like it
> should work???

  portal['MyNewFolder']

> 5. so i settle for second best and do
> getPhysicalRoot['Portal']._setObject(aq_base(ob).getId+'pubd',
> aq_base(ob)) - I get a copy, who woo! but in the 'interface' it shows up as
> the old one.  this is because I havent changed any attributes of the
> original object.  thats fine, and attributes are easy to set.  but am I
> skirting around the PortalAddContent API somewhere, doesnt seem very client
> friendly just to shove stuff into the ZODB.  I think I'm missing something.

Look at PortalFolder::invokeFactory - something like

  portal['MyNewFolder'].invokeFactory(type_name,newid)

hth

seb