[Zope] Newbie - passing a list to an External Method
Dylan Reinhardt
zope@dylanreinhardt.com
23 Apr 2003 09:18:44 -0700
On Wed, 2003-04-23 at 08:30, Ashley Lloyd wrote:
> If I return lines_check(lines), then it just sends back:
>
> lines is type: lines has value:
Nothing?? Uh.... that's pretty weird.
>
> Yet if I replace that - in exactly the same place, with return lines, then
> it returns the expected value of lines.
Even weirder.
So let's grasp at the next straw, shall we?
Doing a quick grep over sping, it would appear that the stringformat
module (which you import) also uses a variable called lines. It *looks*
like it defines & used it locally, but I didn't do any real analysis.
Let's just work on the assumption that it's more than a coincidence that
*your* lines variable gets busted at some point after you make use of a
module that *also* has a lines variable.
Give this a try:
-----------------------
# lines changed to my_lines
def run(self)
REQUEST = self.REQUEST
fileID = REQUEST.fileId
my_lines = REQUEST.lines[:] # make a copy, for grins
import sping.stringformat
from sping.PDF import PDFCanvas
from sping.PS import PSCanvas
filename="c:/zopepdf/"+fileID
canvas = PDFCanvas(size=(350,200), name=filename)
y = 20
for line in my_lines:
sping.stringformat.drawString(canvas, line, 10,y)
y += 20
canvas.flush()
canvas.save()
return fileID
-----------------------
Getting warmer?
Dylan