本文整理汇总了Python中view.tools.tools.sendException函数的典型用法代码示例。如果您正苦于以下问题:Python sendException函数的具体用法?Python sendException怎么用?Python sendException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: postTransport
def postTransport(**kw):
try:
order = kw.get('order')
address = kw.get('address')
t = Transport.query.filter_by(status=1, oid=order.id).first()
if t:
t.update_dt = pinpin.getCurTimestamp()
t.address_line1 = address.address_line1
t.address_line2 = address.address_line2
t.tel = address.tel
t.reciver = address.reciver
t.save
return True
else:
t = Transport()
t.oid = order.id
t.status = 1
t.create_dt = pinpin.getCurTimestamp()
t.update_dt = pinpin.getCurTimestamp()
t.address_line1 = address.address_line1
t.address_line2 = address.address_line2
t.tel = address.tel
t.reciver = address.reciver
t.save
return True
except Exception as e:
current_app.logger.info('postTransport Exception %s' % e)
db.session.rollback()
sendException(e, 'postTransport')
return False
示例2: pay
def pay():
try:
if request.method == 'POST':
token = request.json['token']
text = request.json['text'].strip()
if token == 'c53b7e88b6155d08027a69601b5d098e':
current_app.logger.info('bearychat pay text %s' % text)
commond = [c for c in text.split(' ') if len(c) > 0]
if len(commond) == 1 and commond[0] == '/pp':
sendText('不能这么用,请/pp help 查看使用方法')
return 'success'
elif len(commond) == 2 and commond[0] == '/pp' and commond[1] == 'help':
ppHelp()
return 'success'
elif len(commond) == 2 and commond[0] == '/pp' and commond[1] == 'status':
payQuery()
return 'success'
elif len(commond) == 3 and commond[0] == '/pp' and commond[2] == 'status':
c = commond[1]
payQueryById(c)
return 'success'
elif len(commond) == 3 and commond[0] == '/pp' and commond[2] == 'pay':
c = commond[1]
payById(c)
return 'success'
return 'success'
return 'fail'
except Exception as e:
current_app.logger.exception('pay')
sendText('有错误发生了')
sendException(e, 'pay')
return 'fail'
示例3: _order_confirm_succ
def _order_confirm_succ(**kw):
"""
支付收货确认成功
"""
try:
order = kw.get('order')
trade_no = kw.get('trade_no')
# out_trade_no = kw.get('out_trade_no')
if order.trade_no2 == trade_no and order.status == OrderStatus.WAITING:
order.status = OrderStatus.CONFIRMGOODS
order.save
group_operator.tellGroupUpdateOnSended(order.gid)
g = GroupHead.query.get(order.gid)
u = User.query.get(g.create_userid)
param = {
'reciver': u.email,
'nickname': u.nickname,
'title': MailSubject.OrderConfirm_To_Group,
'orderid': order.order_no
}
sendMail(**param)
return True
return False
except Exception as e:
current_app.logger.exception('_order_confirm_succ')
db.session.rollback()
sendException(e, '_order_confirm_succ')
return False
示例4: check_overtime_group
def check_overtime_group():
from module.group.grouphead import GroupHead
from control.pinpin import GroupStatus
from module.user.user import User
from control.sendmail import sendOtGroupMail
from view.tools.tools import sendException
today = arrow.utcnow().to('local').format('YYYYMMDD')
try:
current_app.logger.info('check_overtime_group')
groups = GroupHead.query.filter_by(
status=GroupStatus.GROUPING, value1=0, value2=0, value3=0, value4=0).all()
i = 1
basic = 20
for g in groups:
if arrow.get(g.plancompletedt).format('YYYYMMDD') < today:
u = User.query.get(g.create_userid)
kwargs = {
'nickname': u.nickname,
'reciver': u.email,
'groupno': g.group_no,
'dely': i * basic
}
sendOtGroupMail(**kwargs)
i += 1
except Exception as e:
current_app.logger.exception(
'check_overtime_group')
sendException(e, 'check_overtime_group')
raise
else:
current_app.logger.info('check_overtime_group end')
示例5: _sendAboutUserPassword
def _sendAboutUserPassword(**kw):
try:
title = MailSubject.ResetUserPassword + \
MailSubject.Subject_Suffix
nickname = kw.get('nickname')
email = kw.get('email')
token = kw.get('token')
mode = kw.get('mode')
param = {
'nickname': nickname,
'token': token,
'mode': mode
}
msg = Message(title)
msg.add_recipient(email)
msg.body = render_template("./mail/resetpassword.txt", param=param)
mail.send(msg)
body = render_template("./mail/resetpassword.txt", param=param)
_mailsend(email, title, body)
sendNotifyMail(email, title, param)
return True
except Exception as e:
current_app.logger.exception('_sendAboutUserPassword')
sendException(e, '_sendAboutUserPassword')
return False
示例6: put
def put(self, id):
try:
if current_user.is_authenticated():
uid = current_user.id
isDefault = request.json['isDefault']
a = UserAddressModel.query.get(id)
if a and a.uid == uid:
if isDefault and a.isDefault == False:
setAddressDefault(uid)
address_line1 = request.json['address_line1']
address_line2 = request.json['address_line2']
tel = request.json['tel']
reciver = request.json['reciver']
update_dt = pinpin.getCurTimestamp()
a.address_line1 = address_line1
a.address_line2 = address_line2
a.tel = tel
a.reciver = reciver
a.update_dt = update_dt
a.isDefault = isDefault
a.save
return make_response(jsonify({'messages': 'ok'}), 201)
return make_response(jsonify({'messages': errMsgs.NOT_PERMISSION}), 403)
return make_response(jsonify({'messages': errMsgs.NOT_LOGIN}), 401)
except Exception as e:
current_app.logger.exception('MyAddress put()')
sendException(e, 'MyAddress put()')
return make_response(jsonify({'messages': errMsgs.SERVER_ERROR}), 500)
示例7: post
def post(self):
try:
if current_user.is_authenticated():
uid = current_user.id
isDefault = hasDefaultAddress(uid)
address_line1 = request.json['address_line1']
address_line2 = request.json['address_line2']
tel = request.json['tel']
reciver = request.json['reciver']
create_dt = pinpin.getCurTimestamp()
update_dt = pinpin.getCurTimestamp()
a = UserAddressModel()
a.uid = uid
a.address_line1 = address_line1
a.address_line2 = address_line2
a.tel = tel
a.reciver = reciver
a.create_dt = create_dt
a.update_dt = update_dt
a.isDefault = isDefault
a.save
return make_response(jsonify({'address': a.to_json, 'messages': 'ok'}), 201)
return make_response(jsonify({'messages': errMsgs.NOT_LOGIN}), 500)
except Exception as e:
current_app.logger.exception('MyAddresses post()')
sendException(e, 'MyAddresses post()')
return make_response(jsonify({'messages': errMsgs.SERVER_ERROR}), 500)
示例8: _order_confirm_deposit_succ
def _order_confirm_deposit_succ(**kw):
"""
押金收货确认成功
"""
try:
order = kw.get('order')
trade_no = kw.get('trade_no')
out_trade_no = kw.get('out_trade_no')
if order.trade_no == trade_no and order.status == OrderStatus.CONFIRMED:
order.status = OrderStatus.PAID
order.out_trade_no = out_trade_no
order.deposit_pay_dt = pinpin.getCurTimestamp()
order.save
group_operator.tellGroupUpdateOnGrouping(order.gid)
g = GroupHead.query.get(order.gid)
u = User.query.get(g.create_userid)
param = {
'reciver': u.email,
'nickname': u.nickname,
'title': MailSubject.OrderDesposit_To_Group,
'orderid': order.order_no
}
sendMail(**param)
return True
return False
except Exception as e:
current_app.logger.exception('_order_confirm_deposit_succ')
db.session.rollback()
sendException(e, '_order_confirm_deposit_succ')
return False
示例9: OrderConfirm
def OrderConfirm(order):
'''
buyer try to confirm order
will gen a create alipay url if info matched
alipay will dispay the order on alipay
buyer can confirm this order
then alipay will async notify pinpin interface
and the inferface will confirm the order on pinpin
'''
try:
if order and order.status == OrderStatus.WAITING:
order.status = OrderStatus.CONFIRMGOODS
order.save
group_operator.tellGroupUpdateOnSended(order.gid)
g = GroupHead.query.get(order.gid)
u = User.query.get(g.create_userid)
param = {
'reciver': u.email,
'nickname': u.nickname,
'title': MailSubject.OrderConfirm_To_Group,
'orderid': order.order_no
}
sendMail(**param)
return True
return False
except Exception as e:
current_app.logger.exception('OrderConfirm')
sendException(e, 'OrderConfirm')
return False
示例10: _order_pay_succ
def _order_pay_succ(**kw):
"""
全部支付成功后更新订单
"""
try:
order = kw.get('order')
trade_no = kw.get('trade_no')
out_trade_no = kw.get('out_trade_no')
if order.trade_no2 == trade_no and order.status == OrderStatus.CONFIRMEDSEND:
order.status = OrderStatus.PAIDALL
order.out_trade_no2 = out_trade_no
order.complete_pay_dt = pinpin.getCurTimestamp()
order.save
group_operator.tellGroupUpdateOnPrepare(order.gid)
g = GroupHead.query.get(order.gid)
u = User.query.get(g.create_userid)
param = {
'reciver': u.email,
'nickname': u.nickname,
'title': MailSubject.OrderPay_To_Group,
'orderid': order.order_no
}
sendMail(**param)
return True
return False
except Exception as e:
db.session.rollback()
sendException(e, '_order_pay_succ')
return False
示例11: OrderNegotiationConfirmbyTeamer
def OrderNegotiationConfirmbyTeamer(order):
"""
order is order module
"""
try:
if order.status == OrderStatus.NEGOTIATIONSEND:
order.status = OrderStatus.CONFIRMEDSEND
actual_price = order.transport_fee + order.express_fee + \
order.total_sku_amount - order.deposit
if actual_price <= 0:
order.actual_price = 0.01
else:
order.actual_price = actual_price
order.save
group_operator.tellGroupUpdateOnPrepare(order.gid)
g = GroupHead.query.get(order.gid)
u = User.query.get(g.create_userid)
param = {
'reciver': u.email,
'nickname': u.nickname,
'title': MailSubject.OrderTransFeeConfirm_To_Group,
'orderid': order.order_no
}
sendMail(**param)
return True
return False
except Exception as e:
db.session.rollback()
current_app.logger.exception('OrderNegotiationConfirmbyTeamer')
sendException(e, 'OrderNegotiationConfirmbyTeamer')
return False
示例12: OrderSent
def OrderSent(**kw):
try:
order = kw.get('order')
logistics_name = kw.get('logistics_name')
invoice_no = kw.get('invoice_no')
param = {
'order': order,
'transorg': logistics_name,
'transcode': invoice_no
}
if putTransport(**param):
order.status = OrderStatus.WAITING
order.save
group_operator.tellGroupOrderDelivery(order.gid)
u = User.query.get(order.create_userid)
param = {
'reciver': u.email,
'nickname': u.nickname,
'title': MailSubject.OrderSend_To_Team,
'orderid': order.order_no
}
sendMail(**param)
return True
return False
except Exception as e:
current_app.logger.exception('OrderSend')
sendException(e, 'OrderSent')
return False
示例13: OrderDepositConfirm
def OrderDepositConfirm(order):
'''
'''
try:
if order.status == OrderStatus.PAIDSENT:
t = Transport.query.filter_by(oid=order.id).first()
param = {
'type': 'DEPOSIT',
'out_trade_no': order.trade_no,
'subject': order.order_no,
'body': _getConfirmLines(order),
'price': order.deposit,
'quantity': 1,
'receive_name': t.reciver,
'receive_address': t.address_line1,
'receive_mobile': t.tel
}
PAYMENT_TEST = current_app.config['PAYMENT_TEST']
if PAYMENT_TEST:
order.status = OrderStatus.PAID
order.save
_OrderUpdateInfo(order)
group_operator.tellGroupUpdateOnGrouping(order.gid)
alipayurl = alipay_operator.alipay_pay_on_web(**param)
return alipayurl
return None
except Exception as e:
current_app.logger.exception('OrderDepositConfirm')
sendException(e, 'OrderDepositConfirm')
return None
示例14: OrderNegotiationNegotiationbyTeam
def OrderNegotiationNegotiationbyTeam(**kw):
"""
order
transportfee
expressfee
"""
try:
order = kw.get('order')
transportfee = round(float(kw.get('transportfee')), 2)
expressfee = round(float(kw.get('expressfee')), 2)
if (transportfee < 0.01 and transportfee != 0) or (expressfee < 0.01 and expressfee != 0):
raise Exception('price cant less than 0.01')
if order and order.status == OrderStatus.NEGOTIATIONSEND:
order.transport_fee = transportfee
order.express_fee = expressfee
order.status = OrderStatus.APPLYSEND
db.session.commit()
group_operator.tellGroupUpdateOnPrepare(order.gid)
g = GroupHead.query.get(order.gid)
u = User.query.get(g.create_userid)
param = {
'reciver': u.email,
'nickname': u.nickname,
'title': MailSubject.OrderTransFeeUpdate_To_Group,
'orderid': order.order_no
}
sendMail(**param)
return True
return False
except Exception as e:
db.session.rollback()
current_app.logger.exception('OrderNegotiationNegotiationbyTeam')
sendException(e, 'OrderNegotiationNegotiationbyTeam')
return False
示例15: cancelOrder
def cancelOrder(order):
"""
取消订单
"""
try:
current_app.logger.info('cancel order %s' % order.id)
ols = OrderLine.query.filter(
OrderLine.oid == order.id, OrderLine.status > OrderLineStatus.REJECT).all()
if ols:
for ol in ols:
ol.status = OrderLineStatus.CANCEL
db.session.flush()
db.session.commit()
_CheckOrderNegotiation(order)
_OrderUpdateInfo(order)
group_operator.tellGroupUpdateOnGrouping(order.gid)
current_app.logger.info(
'cancel order succ,Order id is %s' % order.id)
return True
current_app.logger.info('cancel order fail,Order id is %s' % order.id)
return False
except Exception as e:
current_app.logger.info(
'cancel order id is %s exception %s' % (order.id, e))
db.session.rollback()
sendException(e, 'cancelOrder')
return False