[mod_python] passing parameters from index() to POST method

Martijn Moeling martijn at xs4us.nu
Wed Mar 3 08:30:27 EST 2010


I'm nut excacly sure what you are trying to achieve.

In your index.py handler you can:

from wifikeys import gen_keys

def handler(req):
	If req.method == "POST":
		gen_keys(parameters here)
	else:
		normal handler code
	retrun apache.OK



On Mar 3, 2010, at 12:28 PM, Rob Fowler wrote:

> Excuse me if this has been answered, I have searched for an answer but I am open to someone saying 'FAQ ask this'.
> I have a web form with this in it:
> ..
> <FORM value="form" action="wifikeys.py/gen_keys" method="post">
> ..
> the function 'gen_keys' needs a dictionary already read in the index function.
> 
> Is there a normal way to get an objects from 'index' to 'gen_keys' (in other words from the initial python function to the function called by the post)?
> 
> From my understanding, apache calls the index function to get the data to populate the reply then the function yields back to apache, with nothing called until the client 'POSTS' then apache calls the post function specified.
> 
> I use a database so I already solved the lack of database handle on the post method using a singleton and simply instancing it in the post function (globals by any other name) but this function needs different data depending on the form.
> 
> TIA,
> Rob Fowler
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python




More information about the Mod_python mailing list