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

2003-08-24 Thread Dieter Maurer
alan milligan wrote at 2003-8-20 04:43 +:
 > ...
 > >"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???

You use a debugger.

I would add "import pdb; pdb.set_trace()" in "mapply",
start Zope in a console window and make the failing request.

Zope will enter the debugger at the "set_trace".
Read the "pdb" documentation (--> Python library reference)
about the available commands.


Dieter

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


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

2003-08-22 Thread alan milligan

alan milligan wrote at 2003-8-18 09:41 +:
 > ...
 > 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 !
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


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

2003-08-18 Thread Dieter Maurer
alan milligan wrote at 2003-8-18 09:41 +:
 > ...
 > 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.
"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?


Dieter

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )