Suppose I have an AppEngine model defined with twenty different StringProperty properties. And then I have a web form, which POSTs updated values for an entity of this model. I end up with something like this after reading in the form data:
entity_key['name'] = 'new_name'
entity_key['city'] = 'new_city'
entity_key['state'] = 'new_state'
etc...
To actually assign these values to the entity, I'm presently doing something like this:
if property == 'name':
entity.name = entity_key['name']
elif property == 'city':
entity.city = entity_key['city']
elif property == 'state':
entity.state = entity_key['state']
etc...
Is there any way to assign the property values without twenty elif statements? I see that there is the model.properties() function, but I don't see anyway to tie all this together.
All help is appreciated.
Thank you.