[Zope] Passing parameters to external methods
Dominic Mitchell
hdm@mistral.co.uk
Thu, 14 Sep 2000 10:55:18 +0100
On Wed, Sep 13, 2000 at 11:49:03PM +0200, Andreas Pauley wrote:
> Hi,
> I need to pass some parameters to my external methods.
>
> I have an external method that looks (somewhat) like this:
>
> def extAccess(self, accttype_cde):
> return accttype_cde
>
> In the following dtml code, the following statement (with the SQL
> method) works fine:
>
> <dtml-if "sqlAccess(accttype_cde='COM')">
> <b>sqlAccess returned something</b>
> </dtml-if>
>
> This statement, referencing my external method but using the same syntax
> as with the sql method, gives lots of headaches:
>
> <dtml-if "extAccess(accttype_cde='COM')">
> <b>The external method returned true</b>
> </dtml-if>
>
>
> I get the following error for the above statement:
> Error Type: TypeError
> Error Value: not enough arguments; expected 2, got 0
Try doing:
<dtml-if "extAccess(_.None, _, accttype_cde='COM')">
<b>The external method returned true</b>
</dtml-if>
To pass in the namespace of where you're calling from.
-Dom