ManifestVersion.all() returns a Query object.
You must get or fetch them before you can use the objects

def incrementVersion():
   versionList = ManifestVersion.all().get()
   versionList.versionNumber += 1
   versionList.put()
   return versionList.versionNumber

Execute this type of functions in a transaction. Look at the shared
counter article.

2009/3/15 Marcelo Sena <marceloslace...@gmail.com>:
>
> Here is the model I'm trying to update:
>
> class ManifestVersion(db.Model):
>    versionNumber = db.IntegerProperty()
>
> Here is the method that should change the only instance of the
> previous model:
>
> def incrementVersion():
>    versionList = ManifestVersion.all()
>    num = versionList[0].versionNumber
>    num = num+1
>    versionList[0].versionNumber = num
>    versionList[0].put()
>    return versionList[0].versionNumber
>
> But the versionNumber value is never updated and this function always
> returns 1. On the other hand num is changed in this call.
> What am I doing wrong?
> >
>

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