[google-appengine] Re: entity.populate()

2009-01-03 Thread gops

i am using your code , thats easy and cool!! thanks.

On Dec 31 2008, 8:31 pm, "Rodrigo Moraes" 
wrote:
> 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 google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: entity.populate()

2009-01-03 Thread Rodrigo Moraes

On Sat, Jan 3, 2009 at 3:55 PM, gops wrote:
>
> i am using your code , thats easy and cool!! thanks.

cool. i created a feature request for it. star if you think it is worth:

   http://code.google.com/p/googleappengine/issues/detail?id=968

thanks,
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 google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---