I use a 'populate' method in a base model class. Slightly different
from the previously posted function because it'll only update values
of existing properties.
def populate(self, **kargs):
properties = self.properties()
for key, value in kargs.iteritems():
if key in properties:
setattr(self, key, value)
I use it mostly to update an entity using data from a form. For example:
entity = MyModel.get_by_key_name('my_key_name')
entity.populate(**processed_form_data)
entity.put()
-- rodrigo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---