[Zope] Python methods and keyword arguments

Curtis Maloney curtis@cardgate.net
Wed, 21 Feb 2001 11:37:21 +1100


On Wednesday 21 February 2001 02:30, Peter Bengtsson wrote:
> Python method:
> Id =simple_pym
> parameters: val1, val2
>
> Python method:
> Id =advanced_pym
> parameters: self, val1, val2
>
> DTML Method:
> Id: index_html
>
> <code>
>
> <dtml-var "simple_pym(12,24)">
> OK!
> <dtml-var "simple_pym(val1=12,val2=24)">
> OK!
>
> </code>
>
> DTML Method
> Id: index_dtml
>
> <code>
>
> <dtml-var "advanced_pym(12,24)">
> OK!
> <dtml-var "advanced_pym(val1=12, val2=24)">
> FAILS!!!
>
> Error Type: TypeError
> Error Value: not enough arguments; expected 3, got 0
>

It's expecting a 'self' or context to be passed.

Try:  <dtml-var "advanced_pym(_, val1=12, val2=24)">


> </code>
>
>
> Get the problem?
>
> I want to be able to call a Python Method object using keyword arguments or
> whatever it's called when you include the name of the parameters as you
> call the object. How do I do this??
> Does this apply to Python Scripts and External Methods?
>
>
>


Have a better one,
	Curtis Maloney