On Fri, 25 Aug 2000, Daniel Rusch wrote:
>     def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
>         print 'Sub Class __call__'
>         DTMLMethod.__call__(self, client, REQUEST, RESPONSE, kw)
> when I view the BasicMethod in Zope, I get:
> Error Type: TypeError 
> Error Value: too many arguments; expected 4, got 5
> I believe that I need the self arg, if I remove it I get an unbound
> python method error.
> Any thoughts???

DTMLMethod's __call__ only takes three arguments: client, REQUEST,
and RESPONSE.  **kw turns any additional keyword arguments (x=y)
into a dictionary kw.  To pass the ones your __call__ receives on
to DTMLMethod's __call__, you have to turn them back into a keyword
list somehow.  A quick check of the python language reference
doesn't reveal any special syntactic sugar for doing this.  However,
in the definition of __call__ in DTMLMethod I found this:

r = apply(HTML.__call__, (self, client, REQUEST), kw)

Reading about apply in the python docs, it's obviously designed to
do just the job you need <grin>.


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

Reply via email to