[Zope] Functions in a python script

Sedat Yilmazer sedat@kibele.com
Mon, 23 Jul 2001 15:53:53 +0300


 Sorry No global declerations in python scripts yet ( maybe at Zope 2.4 =
with python 2.+)

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Gilles Lenfant
Sent: Monday, July 23, 2001 2:52 PM
To: zope@zope.org
Subject: [Zope] Functions in a python script


Hi,

I found a strange behaviour for a small script that runs correctly in =
pure
Python:
=3D=3D SNIP =3D=3D
foo =3D 'a great text'

def bar():
  # error below
  return foo

return bar()
=3D=3D/SNIP=3D=3D
It makes a "NameError" on "foo" !!!
If the first line of bar() is "global foo", this does not change =
anything.

How to use python functions inside Zope python scripts ?
Is it reserved for External methods ?
Should I provide all "globals" as arguments to the function ?



_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -=20
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )