[Zope] Problem with a value assigned in a session mysteriously being overwritten by 0

Charlie Clark charlie@begeistert.org
Wed, 13 Nov 2002 14:40:09 +0100


Hi,

I'm currently using Zope 2.5.1 and have recently discovered a really nasty problem which I cannot explain 
and am having great difficulty finding a workaround.

I have a log-in process with several forms and I use a session object to keep some data (ie. foreign 
keys) between forms.

This has so far worked very well but now one of the values is being overwritten by 0. I can tell when 
this is happening but can't work out why.

Brief description of what's happening:

1st form -> PythonScript: generate 'id_person' do some database work, assign session['id_person'] = 
id_person,  assign session['username'] = username -> call 2nd form via request.response.redirect

2nd form -> PythonScript: do some more work dependent on the key 'id_person'

Observations:
The 'id_person' is still visible in the session object in the 2nd form but has been assigned to 0 by the 
PythonScript. But it is the only session variable which has been overwritten.

I can't think how this would affect things but I have changed some calls from context.Objectname(request, 
context) to request.response('Objectname').

Any ideas? The only current workaround I can think of is to pass the key as a hidden value through the 
form but I'd like to avoid that if possible.

Charlie