Alessandro de Manzano
ale at unixmania.net
Fri Dec 3 05:57:34 EST 2004
Hi! I'm using mod_python 2.7.10 with Apache 1.3.31 and Python 2.3.4 under FreeBSD 4.10. All works fine but now I need to share some data among handler functions. I've a single python script (not using publisher handler) which "exports" two functions, one as autentication handler and one as main CGI entry point. I read on mod_python's docs that the req object (which both functions obtain as parameter) is a normal, extensibile python object. So is this a correct way to share a variable between them ? : def authenhandler(req): # bla bla do something.. req.mydummy = True .. def main(req): # bla bla do something else if req.mydummy == True: # foobar else: req.myotherdummy = 42 # some data # barfoo I mean, Apache should call first the authenhandler (the script is in a authbasic-only directory, can't access without authentication) and then the "normal" CGI entry point as URL specifies, right ? Are there, maybe, problems with concurrent accesses ? (I guess not, since a single Apache process execute just a single python interpreter instance with my script, if I understand correctly) Any hints and suggestions are more than welcome! :-) Thanks in advance! -- bye! Alessandro de Manzano Milano, Italy
|