hi Jeff ,
Thanks for your reply.
But I did not use form to execute the request.
I trigger the datastore data insertion by one browser request, and it
can be seen on the log (yes, there is only one and only one request).
I have changed my code to below to see what happen to the datastore.
============
#coding=utf-8
from google.appengine.ext import db
class Order(db.Model):
time = db.DateTimeProperty(auto_now_add=True)
stri = db.StringProperty()
obj1 = Order(stri='y')
obj1.put()
obj2 = Order(stri='n')
obj2.put()
==========
Running the query of "SELECT * FROM Order order by time desc" , the
result is :
(so you can see the server seems to request the site again after I
have done so)
But if I request it by cron job , there are only 2 entities inserted,
instead of 4.
id=60002 n 2010-05-20 04:33:24.450649
id=20004 y 2010-05-20 04:33:24.389974
id=66004 n 2010-05-20 04:33:23.886866
id=35006 y 2010-05-20 04:33:23.774130
On May 20, 12:04 am, Jeff Schwartz <[email protected]> wrote:
> Perhaps if your db operation is driven by a form the user refreshed their
> browser. If they did then the form would post the request again. The
> solution is to redirect after a post to clear out the headers.
>
>
>
>
>
> On Wed, May 19, 2010 at 6:53 AM, Dennis <[email protected]> wrote:
> > I have used the code below to insert an entity (yes , supposed to be
> > only one entity inserted per request). However, it has inserted two
> > entities per request.
>
> > Do you encounter this problem ?
>
> > Thanks.
> > =============
>
> > #coding=utf-8
> > from google.appengine.ext import db
>
> > class Order(db.Model):
> > time = db.DateTimeProperty(auto_now_add=True)
> > stri = db.StringProperty()
>
> > obj1 = Order(stri='test')
> > obj1.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]<google-appengine%2Bunsubscrib
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.
>
> --
> --
> Jeff
>
> --
> 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
> athttp://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.