Joseph,
You can try this code:
def put(self):
count = 0
while True:
try:
return db.Model.put(self)
except:
count += 1
if count == 3:
raise
Cheers,
Alex
--
www.muspy.com
On Jan 15, 4:09 am, "[email protected]"
<[email protected]> wrote:
> I have the basics, which are posted below. However, this is where I'm
> realizing I'm still very new at learning python. What I'd like to do
> it only catch the timeout error for the retries, and at the end of the
> retries go ahead and return the timeout error, as if it's failed 3
> times, I'm going to assume it will keep failing and it's up to the
> application to handle that.
>
> class ROTModel(db.Model):
> """
> Retry On Timeout Model. This model exists to override the put
> method of
> db.Model in order to retry the put operation when a timeout error
> is encountered.
> """
> def put(self):
> count = 0
> while count < 3:
> try:
> return db.Model.put(self)
> except:
> count += 1
> else:
> raise datastore._ToDatastoreError()
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---