I've been working with some of my coworkers tracking a problem very
similar to the one described in this thread:

which is also outlined here:

and I've found out some things which may be helpful in finding a better
long-term solution.

There appears to be a problem with the way that External Methods are
inspected when called via XML-RPC.  Specifically, mapply() doesn't know
what arguments the external method is expecting, apparently because the
'func_defaults' attribute of the object doesn't seem to be set
properly.  Interestingly enough, if apply() is called then the external
method is fully inspected (presumably because it's actually invoked),
after which the external method call works properly via XML-RPC.

Practically this means that when I invoke an external method via XML-RPC
and pass the correct arguments, mapply() doesn't know what arguments the
method is expecting, assumes (in essence) that it expects 0, and returns
'too many arguments' (where 1 > 0).  However, if I invoke the external
method with *no* arguments, mapply() assumes that everything is good and
invokes apply(), which throws a TypeError (function expects at least 1
argument, 0 given).  If I then invoke the method *again* with the proper
arguments (i.e. I use exactly the same call I made the first time), then
the object inspected by mapply() has the 'func_defaults' attribute
correctly set and the method works properly.

I've spent the better part of two days sprinkling LOG() calls throughout
ZPublisher, so I can give some more detailed information if anyone's
really interested.

In the meantime, I temporarily hacked my local copy of mapply() to
invoke apply(object, '') for every call, forcing the method to be
properly inspected/cached/whatever, then caught the TypeError and moved
on to the rest of mapply.  This worked for me, causing all of my XML-RPC
calls to function properly, but concerned me because it opened the
possibility of apply(object, '') being called successfully twice for an
object that takes no arguments.

So I backed that out and hacked by local copy of publish() instead,
calling apply(object, '') for any object whose path matches my external
methods.  This should work for us without any unintended side effects,
but I'd obviously like to be involved with a long-term solution that
would benefit the whole community.

Please let me know if there's any more information I can give or
anything else I can contribute.  I'd be glad to do more legwork, but I
got bogged down last night trying to unravel the inspection/creation of
external method objects, and can't really proceed effectively without
some pointers on how that stuff works and where to poke around.

Thanks very much,

Nathan 'Nato' Uno
Hostway Corporation

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to