[Zope] Newbie - passing a list to an External Method

Ashley Lloyd ashleylloyd@hotmail.com
Tue, 22 Apr 2003 17:21:06 +0100


Thanks once again for all of your advice - and sorry for tying up so much of 
your time. It is very much appreciated.

Having just arrived home from work, I don't have code that I could paste, 
and I am not entirely certain what you mean, so I'll try to explain the best 
I can.

In dtml the dtml method calling the external method function, it is called 
with the 2 parameters I listed in the dtml-let previously.

In the function definition in the actual python module (in the Extensions 
folder), the self parameter is now the first parameter listed, so:
def run(self, fileID, lines) # if I remember rightly
After changing this, I just clicked save changes in the ZMI screen for the 
External Method

I don't know of anywhere else I should have defined the parameters, so 
hopefully that is about it.

Regarding the advice on function names, thank you for that. Of course it 
makes perfect sense, and should be obvious to anyone with some sense!

Thanks yet again

Ashley


From: Dylan Reinhardt <zope@dylanreinhardt.com>
Reply-To: zope@dylanreinhardt.com
To: Ashley Lloyd <ashleylloyd@hotmail.com>
CC: zope@zope.org
Subject: Re: [Zope] Newbie - passing a list to an External Method
Date: 22 Apr 2003 09:12:46 -0700

On Tue, 2003-04-22 at 08:31, Ashley Lloyd wrote:
 > Thanks again for your help Dylan.
 >
 > If I set the External Method parameters to (self, fileID, Lines)

Are you adding "self" to the parameter list of the external method
object in Zope?  You shouldn't be.

Just make it the first parameter in the external method _code_.  Don't
change the external method object or the DTML code that calls it.

Let's see where that gets us...

Dylan


PS - On a tangent, it's a really good idea to get in the habit of giving
your functions specific, descriptive names (like "create_pdf()") rather
than naming them after a module they import or using common terms like
"run()" (a name which is used elsewhere in the language).  This makes
troubleshoot easier and reduces the odds that you'll accidentally
encounter a namespace collision.




_________________________________________________________________
Express yourself with cool emoticons http://www.msn.co.uk/messenger