9 messages in com.googlegroups.google-appengine[google-appengine] Re: Problem with d...
FromSent OnAttachments
Alessandro Arrichiello30 Jul 2008 09:07 
Alessandro Arrichiello30 Jul 2008 15:18 
Calvin Spealman30 Jul 2008 15:31 
Alessandro Arrichiello30 Jul 2008 15:45 
Calvin Spealman31 Jul 2008 07:52 
blep03 Aug 2008 06:39 
Alessandro Arrichiello04 Aug 2008 02:28 
Alessandro Arrichiello04 Aug 2008 02:46 
Calvin Spealman04 Aug 2008 09:35 
Subject:[google-appengine] Re: Problem with datastore, .put() function seems to not update the entity edited
From:Calvin Spealman (iron@gmail.com)
Date:07/30/2008 03:31:28 PM
List:com.googlegroups.google-appengine

user = db.GqlQuery("SELECT * FROM Users WHERE account = :1", account).get() # Notice we add the call to get() here user.url = referrer user.put()

On Wed, Jul 30, 2008 at 6:18 PM, Alessandro Arrichiello <Alez@gmail.com> wrote:

Please, can you make me an example?

Thanks,

On Jul 31, 12:11 am, "Calvin Spealman" <iron@gmail.com> wrote:

Something you are saying isnt correct, because subscripting on the GqlQuery instance isn't even supported. You call get(), but don't actually keep the returned entity, which is what you should change the properties on and call the put() method of.

On Wed, Jul 30, 2008 at 12:07 PM, Alessandro Arrichiello

<Alez@gmail.com> wrote:

Hello there, I've problem with datastore on google AppEngine, .put() function seems to not update the entity previously edited:

I wish to perform a method to insert a new object in datastore and edit it if it already exist.

I've this Class:

class Users(db.Model): account = db.StringProperty(required=True) url = db.StringProperty(required=True)

and this code somewhere in the main: suppose: account="something" and referer="http://somewhere", they are two strings

user=db.GqlQuery("SELECT * FROM Users WHERE account = :1", account) if (user.get()): user[0].url=referer user[0].put() else: p1=Users(account=account, url=referer) p1.put()

All works OK except: re-sending to datastore with: user[0].put() I've also tried: db.put(user) but same results!

Datastore keep the old value!

Hope that someone could help me,

regards,

Alessandro.