[mod_python] pass variables between functions.

donnie jones donniejones18 at gmail.com
Fri Feb 11 12:48:47 EST 2005


Hello,

I am wanting to have a variable's data between two functions, but I
can't seem to find a reasonable way to do this with modpython
publisher...

example:

x=0

def test(req):
  global x
  x = 1

def add(req):
  global x
  x=x+1
  req.write("%d" % x)


I would like for x to have a consistent value between the functions...
I thought maybe doing req.x = 1 might work, but I did not have success
between the functions, req would not maintain the value.

Any suggestions would be great.
Thank you.

__
Donnie


More information about the Mod_python mailing list