[mod_python] request object and forms - newbie question

Graham Dumpleton grahamd at dscpl.com.au
Sat Dec 23 18:28:05 EST 2006


Please keep followups on the mailing list.

On 24/12/2006, at 9:38 AM, Ben Barker wrote:

> Thanks - I have just found that from the previous message. So "form"
> is instantiated whenever a .psp page is loaded then.

Sort of. The underlying PSP code only actually creates the instance of
FieldStorage if your code in the PSP page actually tries to reference
the 'form' variable. Thus, don't use the 'form' variable and it does not
create it.

> It seems then that the main difference between mpd_python psp and, for
> instance, spyce using mod_python is one of syntax alone?

But also that mod_python PSP is bound to mod_python whereas any
others are possibly more generic and can be used with a range of
frameworks.

> Ben
>
> On 23/12/06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
>>
>> On 24/12/2006, at 8:08 AM, Ben Barker wrote:
>>
>> > Hi,
>> >
>> > I have just started using mod_python PSP. I have a couple of
>> > questions:
>> >
>> > Firstly, I am trying to upload things from a form and then capture
>> > those variables, either through GET or POST.
>> >
>> > I have been looking for some examples of info on how to upload
>> > variables, and also how to upload and save files, but have been  
>> making
>> > slow progress. I know I have to use toe request object, but am not
>> > getting anywhere fast. Any advice on a good source for a basic
>> > tutorial?
>>
>> Access the 'form' attribute from PSP pages. It is an instance of the
>> FieldStorage class (see documentation). It will give you access to
>> form fields for GET/POST forms.
>>
>> Graham
>>


More information about the Mod_python mailing list