Proper way to access entity key outside the original class

I'm coding my first GAE web app in Python. I need to collect ~30 properties and instantiate a Client object (I'm using Model.db). I'd like to accomplish this on 4 separate sequential forms. If I use a separate page handler for each form, what is the best way to extract and reference the key or id on each form and put data into the same data entity? How do I avoid a global variable?


Not sure I follow... You may need to explain the issue a little more clearly.

First, do not use a global variable.

You can have 4 forms on the same template, all with the same handler. Give each a separate hidden attribute. Or, depending on your templating package, you should be able to access the form by ID.

In your handler:

entity = MyModel.get_by_key_name('my_key_name') 
if request.method == 'POST':
    if request.POST['hidden_field'] == 'firstform':
        entity['prop_1'] =
    if request.POST['hidden_field'] == 'secondform':
    return <template>

You will need to modify the syntax above to suit your templating pkg.

Need Your Help

Install TortoiseHG on a shared drive?

mercurial tortoisehg

Would it be possible to put install THG on a shared drive and let