Try This:

   test = Test.gql("WHERE name = :1", "blah")   # First check if name=blah
exists
    if test.count(1) == 1: # If Already exists update pagehit += 1
          test.pagehit = 1
          test.put()
    else:     # If not exists then create new
          test = Test()
          test.name = "blah"
          test.pagehit = 1
          test.put()


Regards
Sarfaraz
--
Strong and bitter words indicate a weak cause




On Mon, Dec 27, 2010 at 5:55 AM, Tim Hoffman <[email protected]> wrote:

> Hi
>
> You need to read the getting started on the datastore, you are making some
> basic errors there.
>
>
> http://code.google.com/appengine/docs/python/gettingstarted/usingdatastore.html
>
>
> Each time that code is run you are creating a new entity, not fetching an
> existing one.
>
> Rgds
>
> T
>
> --
> 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]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

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