Re: passing parameters from index() to POST method

Martijn Moeling <[email protected]> Wed, 3 Mar 2010 14:30:27 +0100
Newsgroups gmane.comp.python.mod_python
Message-ID <[email protected]>
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
> [email protected]
> http://mailman.modpython.org/mailman/listinfo/mod_python