[Zope-dev] __call__() takes exactly 1 argument (4 given) !!!!!!!!!!!

alan milligan alan_milligan at hotmail.com
Wed Aug 20 05:43:41 EDT 2003


>
>alan milligan wrote at 2003-8-18 09:41 +0000:
>  > ...
>  > I am getting this message out of HelpSys/STXTopic and
>  > Products/CMFCore/PortalContent using Zope2.6.2b2 and CMF1.3.1.
>  >
>  > It's happening out of ZPublisher/Publish calling the default method to
>  > publish the object.
>  >
>  > For some reason, the delivered code works fine in development (Linux 
>2.4.21,
>  > Python2.1.3, Zope 2.6.2b2, CMF1.3.1) but not in production, which 
>strangely
>  > has the same software (different hardware though).
>  >
>  > I've patched both the offending __call__ method's function signatures 
>to
>  > include REQUEST, *args, and **kw - which I believe is the standard 
>signature
>  > for stuff called from ZPublisher.
>
>This is not the case. Quite to the contrary, ZPublisher (its "mapply") 
>cannot
>handle "*args" and "**kw" argument definitions.
>
>For some unknown reason, "mapply" seems to get the method signature
>wrong and thinks it has to call the object with 4 arguments.
>Apparently, your change did not modify what "mapply" sees and
>your object now accepts (almost) arbitrary many arguments.

Well, the additional parameters I added aren't used in the function itself, 
there is no other side effect than to stop this exception.  It would of 
course be better to pass the 'correct' parameters if at all possible.

>"mapply" is often tricked out by a "func_code" definition.
>Maybe, your class has such an attribute and it does not
>match the "__call__" signature?

Hmmm - this isn't MY class, it's HelpSys::STXTopic.  I can't see any 
func_code definition in the HelpSys source.  STXTopic's __call__ function is 
declared as __call__(self, REQUEST=None) which looks quite fine to me.

Therefore mapply is getting it wrong and passing too many parameters into 
this call.  How do I discover what mapply is passing???

_________________________________________________________________
Gaming galore at  http://xtramsn.co.nz/gaming !




More information about the Zope-Dev mailing list