nineclue at bigfoot.com
nineclue at bigfoot.com
Tue Apr 17 16:32:06 EST 2001
Greetings... I've posted somewhat long python program during development, which may need pg module, postgres running with pyweb db created etc... Here's short version, which don't work as I expected. from mod_python import apache session_data = {} session_counter = 0 def handler(req): global session_data, session_counter if session_data.has_key('counter'): session_data['count'] = session_data['count'] + 1 else: session_data['count'] = 0 session_counter += 1 req.write('<HTML>') req.write('Session data has %d items<BR>' % len(session_data)) req.write('Counter : %02d<BR>' % session_data['count']) req.write('Alternative Counter : %02d<BR>' % session_counter) req.write('</HTML>') return apache.OK When I loaded the page and tried several reloads, session_data dictionary variable is never increased and session_counter variable is increased after several tries. What I expected was both variable increase at each reload. In my thoughts, dictionary variable is not supported and main interpreter is created in each Apache processes, which is shared by subinterpreters. Sorry for posting again, long message and my poor English. Thanks in advance.
|