[Zope] External method default arg weirdness

Paul Winkler slinkp23@yahoo.com
Wed, 09 May 2001 14:23:35 -0400


Dieter Maurer wrote:
> 
> Paul Winkler writes:
>  > This is with Zope 2.2.2.
>  > If I give a default argument to the external method, and call it
>  > from a dtml method, the default gets used even if I pass the
>  > argument.
>  >
>  > Example: Try creating two external methods and calling them like
>  > this from standard_html_footer.
>  >
>  > <dtml-var "my_ext_method1(_['id'])">
>  > <dtml-var "my_ext_method2(_['id'])">
>  >
>  >
>  > Here are the two external method definitions:
>  >
>  > def my_ext_method1(id):
>  >      return "<br>%s" % id
>  >
>  > def my_ext_method2(id="oops"):
>  >      return "<br>%s" % id
>  >
>  >
>  >
>  > Anybody else get this? Why does it do that?
> I know this only, if the first parameter is called "self".
> 
> We use default parameters regularly (in Zope 2.1.6) and
> they work as expected.

Uhhh... duh, you're right. The methods I was actually using have
"self" as first parameter.

But I don't understand why that affects the rest of the
parameters??? Very un-pythonic.


-- 
...................    paul winkler   ....................
custom calendars & printing: http://www.calendargalaxy.com
       A member of ARMS:   http://www.reacharms.com
            home page:  http://www.slinkp.com