Passing parameters to external methods
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 Anybody any ideas? Thanks, Andreas. -- In a world without fences, who needs gates?
Ive always sent through the REQUEST with no problem, <dtml-var "externalmethod(REQUEST)"> if you can do that. ----- Original Message ----- From: "Andreas Pauley" <andreasp@qbcon.com> To: "Zope" <zope@zope.org> Sent: Wednesday, September 13, 2000 2:49 PM Subject: [Zope] Passing parameters to external methods
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
Anybody any ideas?
Thanks, Andreas.
-- In a world without fences, who needs gates?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
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
Andreas Pauley wrote:
I have an external method that looks (somewhat) like this:
def extAccess(self, accttype_cde): return accttype_cde
<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
Yup, been there, done that, the thread's in the zope-dev archive if you're interested... The way external methods handle parameters is 'interesting' to say the least. Your safest bet is just to use the REQUEST variable to pass stuff, as someone else suggested. cheers, Chris
participants (4)
-
Andreas Pauley -
Andy McKay -
Chris Withers -
Dominic Mitchell