When I use the code below, a new message with the same Person
ReferenceProperty (and same "handle") results in a new db instance,
rather than updating the existing entity as I think it should
according to
the following link.  Isn't it supposed to just update the existing
instance,
without creating another?

http://code.google.com/appengine/docs/python/datastore/creatinggettinganddeletingdata.html

Thanks,

Brian in Atlanta

*******************code excerpt below

class Person(db.Model):
    user = db.UserProperty()
    address = db.EmailProperty()
    skillName = db.StringProperty()

class Message(db.Model):
    owner = db.ReferenceProperty(Person)
    comment = db.TextProperty()
    handle =  db.StringProperty()


class SendMessage(webapp.RequestHandler):
    def post(self):
        skillName_id = self.request.get('skillName')
        handle = self.request.get('handle')
        comment = self.request.get('comment')
        key = db.Key.from_path("Person", skillName_id)
        person = Person.get(key)
        message = Message(handle=handle,owner=person.key())
        message.comment = comment
        message.handle = handle
        message.put()


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

Reply via email to