p.own = True data = '{"success":true}' safe = True try: p.save() except _mysql_exceptions.Warning: pass except Exception, e1: safe = False data = '{"success":false, msg: "%s"}' % (e1.args) if safe: if param_exist("addloan",req): pe = Person(pk=req['person.id']) l = Loan(person=pe, amount=p.total, date=p.date, reason=p.shop) try: l.save() except _mysql_exceptions.Warning: pass except Exception, e1: safe = False data = '{"success":false, "msg": "%s"}' % (e1.args) return data @json_response def update(request): req = request.REQUEST p = fromParams(req);