[Zope-CMF] DefaultWorkflow.py -- how do I extend this?
alan runyan
runyaga@thisbox.com
Thu, 3 May 2001 02:41:10 -0500
ok. this is fairly basic Zope CMF juju.
I'm trying to modify the DefaultWorkflow.DefaultWorkflow class. what I want
to do is add a hook on 'publish'. (is this where I add it?) which evaluates
what type of content it is and place it in MyNewFolder. I am stuck at very
beginning.
first, I think I kinda understand the workflow API:
in DefaultWorkflow.DefaultWorkflow().doActionFor() I goto
action=='publish'
1. I get the object out of the acquisitionWrappers myNewObject=aq_base(ob)
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.
3. but I know my Portal resides in /Portal so I can get there by
getPhysicalRoot()['Portal']
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???
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.
FYI: the tupilize() def is in both CMFCore.utils and CMFDefault.utils
~runyaga