[ http://issues.apache.org/jira/browse/MODPYTHON-38?page=comments#action_65493 ] Graham Dumpleton commented on MODPYTHON-38: -------------------------------------------
Whoops, got the following code wrong in a couple of ways: global_scope.update({"req":req.form, "session":req.session, "form":form, "psp":psp}) Should be something like: global_scope.update({"req":req,"psp":psp}) if hasattr(req,"form"): global_scope["form"] = req.form else: global_scope["form"] = None if hasattr(req,"session"): global_scope["session"] = req.session else: global_scope["session"] = None Another thing to be considered is that if PSP object is used from external handler and session object is created by external handler, should the PSP class still be responsible for saving the session. Ie., should it do: if session is not None: session.save() elif hasattr(req,"session"): req.session.save() > Passing req.form into psp.PSP(). > -------------------------------- > > Key: MODPYTHON-38 > URL: http://issues.apache.org/jira/browse/MODPYTHON-38 > Project: mod_python > Type: Improvement > Versions: 3.1.4 > Reporter: Graham Dumpleton > Priority: Minor > > When calling psp.PSP() explicitly to render PSP pages, it will internally > setup > req.form if it determines that the form is accessed by the PSP page. > Problem is that if you are wanting to trigger psp.PSP() from a publisher > function > any form parameters have already been processed and req.form created. For a > POST request this is problematic as in doing this it will have consumed all > the > content of the request. > This means that when the form is processed a second time by psp.PSP(), it will > find no request content. Thus, the PSP page will only be able to make use of > GET form parameters and not POST form parameters. > It would be an improvement if psp.PSP() allowed a instance of > util.FieldStorage > which has previously been created to be passed in through the "form" parameter > of the constructor. Ie., > template = psp.PSP(req,filename=path,vars=settings,form=req.form) > template.run() -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira