And the problem only happens intermittently? If so, is it frequent enough that you could do some logging to figure out what is happening in the cases of failure? If you can do some logging, maybe check things like db._lastsql, transaction.update_record.colset, and transaction.update_record.id right before/after the update.
If you want to check for success, I suppose you could select the record again, though that will result in an extra database hit. Anthony On Monday, June 1, 2015 at 10:43:30 AM UTC-4, peter wrote: > > Here is the routine. > > The emails both before and after get sent fine.. > > The software sends an email to spinjazzticke...@gmail.com so we have a > record of bookings in case of a database meltdown. > > > > def paypal_complete_a(): > import datetime > from paypal import PayPal > paypal = PayPal() > resp=paypal.GetExpressCheckoutDetails(request.vars.token) > mail.send(to=['me_for_debugg...@gmail.com'], > subject="resp", > message='A' if not request else 'a '+str(resp) > ) > > transaction=db(db.transactions.token==request.vars.token).select().first() > resp=paypal.DoExpressCheckoutPayment(request.vars.token, > request.vars.PayerID, transaction.amount) > if not resp['ACK']=='Success': > redirect(URL('paypal_failure')) > transaction.status='booked' > transaction.update_record() > > > event=db.events[transaction.event_id] > get_tickets(event,transaction.quantity) > scheduler.queue_task('save_sqlite') > if transaction.quantity == '1': > tickets=' ticket booked for ' > else: > tickets=' tickets booked for ' > mail.send(to=['spinjazzticke...@gmail.com'], > subject=event.band, > message='{0}{1}{2} on {3} bought by {4} > {5}'.format(transaction.quantity,tickets,event.band,show_date(event.date), > auth.user.first_name,auth.user.last_name) > ) > mail.send(to=[auth.user.email], > subject=event.band, > message='{0} {1} you have {2}{3}{4} on {5}. Order number > is {6}'.format(auth.user.first_name, auth.user.last_name, > transaction.quantity,tickets,event.band,show_date(event.date), > transaction.id) > ) > return > > > Thanks > Peter > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.