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

Ashley Lloyd ashleylloyd@hotmail.com
Wed, 23 Apr 2003 10:11:53 +0100


Chris,
Thanks for your email, much appreciated.

I've tried as you suggested, and again I can retrieve the values from within 
the External Method (if I just return fileID or lines, without actually 
trying to do anything with them, it works fine), but if I attempt to get at 
the strings inside the lines variable, it fails.

If I am correct, the error I seem to get (removing the try..except from the 
script, this is the error shown in the dtml-method) is:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Error Type AttributeError

Error Value __getitem__

Traceback (most recent call last):
File "C:\PROGRA~1\ZopeSite\lib\python\DocumentTemplate\DT_Try.py", line 149, 
in render_try_except
result = render_blocks(self.section, md)
File "C:\PROGRA~1\ZopeSite\lib\python\DocumentTemplate\DT_Let.py", line 75, 
in render
else: d[name]=expr(md)
File "C:\PROGRA~1\ZopeSite\lib\python\DocumentTemplate\DT_Util.py", line 
159, in eval
return eval(code, d)
File "", line 2, in f
File 
"C:\PROGRA~1\ZopeSite\lib\python\Products\ExternalMethod\ExternalMethod.py", 
line 205, in __call__
return apply(f,(self.aq_parent.this(),)+args,kw)
File "C:\PROGRA~1\ZopeSite\Extensions\formatted-strings.py", line 29, in run
for line in lines:
AttributeError: __getitem__
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The part of run() it seems to refer to:
   y = 20
   for line in lines:
       sping.stringformat.drawString(canvas, line, 10,y)
       y = y + 20

Again, if I just return lines, or fileId, just before "for line in lines", 
it returns fine.

Thanks again .. to everyone!

Ashley

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