> "If an instance has been stored before, the put() method updates the > existing entity."
As I wrote, Message(handle=handle,owner=person.key())" makes a new instance. It's a constructor - it makes a new instance regardless of what the arguments are. A new instance, by definition, has not been stored before. (No, putting an instance made by calling the constructor with the same arguments does not change what db.Model subclass constructors do. Constructors make new instances. The only exception to that rule doesn't apply here.) If you use key_name and parent, the constructor will make a new instance with a specific key. If there is a stored entity with that key, putting said instance will overwrite the previously stored entity. However, that the sentence quoted above does not apply in that situation because a new instance is not an instance that has been stored before. On May 29, 8:51 pm, thebrianschott <[email protected]> wrote: > Andy, > > I am basing my approach on the following sentence at the > following link. > > "If an instance has been stored before, the put() method updates the > existing entity." > > http://code.google.com/appengine/docs/python/datastore/creatinggettin... > > What am I missing? > > Brian in Atlanta > > On May 29, 11:27 pm, Andy Freeman <[email protected]> wrote: > > > > > > > > message = Message(handle=handle,owner=person.key()) > > > That line always creates a new Message instance. Why do you think > > that it should do anything else? (The only way to get copies of > > existing instances is with get() and queries.)- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
