Can you use get_or_insert to update an object with the given key_name?

------------------
**kwds
Keyword arguments to pass to the model class if an instance with the
specified key name doesn't exist. The parent argument is required if
the desired entity has a parent.
------------------

2009/5/18 Nick Johnson (Google) <nick.john...@google.com>:
>
> Hi Astrid,
>
> If your entities have key names, you can use the get_or_insert function:
>
> MyEnt.get_or_insert(key_name, title=title, name=name, public=True)
>
> -Nick Johnson
>
> On Sun, May 17, 2009 at 2:20 AM, astrid.thuec...@googlemail.com
> <astrid.thuec...@googlemail.com> wrote:
>>
>> When one creates a new entity one can give all the parameters to the
>> constructor:
>>
>> MyEnt(title=title, name=name, public=True, ...)
>>
>> But if I modify an entity already stored I need to write it in single
>> lines:
>> me = MyEnt.all().filter("index =", index).fetch(1)[0]
>> me.title = title
>> me.name=name
>> me.public=False
>> ...
>>
>> is there a shorter way to do this?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to