[Zope-CMF] WorkflowMethod wrapper for Event/edit breaks XMLRPC

Joel Burton joel at joelburton.com
Fri Aug 13 23:50:46 EDT 2004


While trying to write an XMLRPC script that creates and edits both News 
and Event types, I tripped across a piece of the broken WorkflowMethod 
machinery.

Event.edit() is workflow-method wrapped. NewsItems.edit() is not.
News items are editable via XMLRPC, Events are not. 
ZPublisher/mapply.py, in mapply, checks for and uses func_code for the 
function called. Since Event.edit is wrapped, and doesn't expose it's 
func_code (it's on the ._m attribute, which is the actual method), 
mapply raises an exception that func_code can't be found.

(I believe there were similar problems with WebDAV not playing well
with WorkflowMethods)

There seem to be a few possibilities:

1. Have the few pieces in CMFDefault that wrap edit have alternate,
    unwrapped edit functions. Then these could be called from XMLRPC.

2. Put a check in mapply that, if it can import WorkflowMethod, and
    object is of the class WorkflowMethod, uses the real method in _m.

3. Expose func_code in wrapped methods (not sure if this is feasible).

4. Remove the wrapping of edit on things in CMFDefault/CMFCalendar.

I don't run the server I'm trying to execute XMLRPC on (actually, it's 
zope.org and plone.org!) so #1 seems unlikely, and a bad fix anyway.
#2-4 seem better options.

Is anyone using WorkflowMethods on CMFDefault stuff? They're 
inconsistently applied, so it seems unlikely that they're widely used.

Any advice on how to proceed would be appreciated.

Thanks!

- j.


More information about the Zope-CMF mailing list