Hey,
I am missing a way to populate an entity with data from a dict (or a
list of tuples with key/value). We can do this with new entities:
entity = ModelFoo(**data)
... but how about existing entities? Wouldn't a populate() (or load(),
or call it a better name :-) Something like:
entity = ModelFoo.get_by_id(id)
entity.populate(data)
It's pretty simple, and I am wondering if it would not be worth to
have in Molel:
def populate(self, data):
properties = self.properties()
for key, value in data.iteritems():
if key in properties:
setattr(self, key, value)
... or: maybe I am missing a feature that already exists?
thank you,
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
-~----------~----~----~----~------~----~------~--~---