quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory (Grisha) Trubetskoy" <gri...@apache.org>
Subject Re: [jira] Commented: (MODPYTHON-38) Passing req.form into psp.PSP().
Date Tue, 22 Mar 2005 04:00:56 GMT


On Mon, 21 Mar 2005, Nicolas Lehuen wrote:

> Alternatively, the FieldStorage constructor is passed the request
> object as an argument. It could check whether the req.form field is
> set and just return it if so (using the __new__ special method instead
> of __init__).

Since FieldStorage already does take a req as an argument, this seems like 
the neatest solution of all. +1 for this, (unless there is some hidden 
caveat I can't think of right now :-) )

> Another way to solve this problem is that mod_python ALWAYS initialize
> req.form before calling the handler. We would solve all the problems
> about people not knowing whether if must be initialized or not. Is
> there a reason why it has not been done before ?

Nah, request and form are on different layers network-wise - request is a 
low-level object that exists for any request/response protocol that could 
potentially be supported by Apache. So if the protocol is e.g. FTP or 
POP3, then a "form" has no meaning.

Grisha


>
> Regards,
> Nicolas
>
>
> On Sun, 20 Mar 2005 22:31:20 +0100 (CET), Graham Dumpleton (JIRA)
> <jira@apache.org> wrote:
>>      [ http://issues.apache.org/jira/browse/MODPYTHON-38?page=comments#action_61282
]
>>
>> Graham Dumpleton commented on MODPYTHON-38:
>> -------------------------------------------
>>
>> A workaround at present seems though to be to pass in "req.form" explicitly
>> through the "vars" dictionary of user settings. This will the take precedence
>> over that set up by psp.PSP(). It is still wasteful for psp.PSP() to process
>> the form parameters a second time.
>>
>>     settings.update({"form":req.form})
>>     template = psp.PSP(req,filename=path,vars=settings)
>>     template.run()
>>
>>
>>> 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
>> -
>> If you want more information on JIRA, or have a bug to report see:
>>    http://www.atlassian.com/software/jira
>>
>>
>

Mime
View raw message