def update_expression(cls, expression_id, content, func, op, right_value, uic_groups, max_step, priority, note, url, callback, before_callback_sms, before_callback_mail, after_callback_sms, after_callback_mail): e = Expression.get(expression_id) if not e: return 'no such expression %s' % expression_id a = Action.get(e.action_id) if not a: return 'no relation action' Action.update_dict( { 'uic': uic_groups, 'url': url, 'callback': callback, 'before_callback_sms': before_callback_sms, 'before_callback_mail': before_callback_mail, 'after_callback_sms': after_callback_sms, 'after_callback_mail': after_callback_mail }, 'id=%s', [a.id]) Expression.update_dict( { 'expression': content, 'func': func, 'op': op, 'right_value': right_value, 'max_step': max_step, 'priority': priority, 'note': note, }, 'id=%s', [e.id]) return ''
def template_action_update_post(tpl_id): tpl_id = int(tpl_id) t = Template.get(tpl_id) if not t: return jsonify(msg='no such template') uic = request.form['uic'].strip() url = request.form['url'].strip() callback = request.form['callback'].strip() before_callback_sms = request.form['before_callback_sms'].strip() before_callback_mail = request.form['before_callback_mail'].strip() after_callback_sms = request.form['after_callback_sms'].strip() after_callback_mail = request.form['after_callback_mail'].strip() if t.action_id > 0: # update Action.update_dict( { 'uic': uic, 'url': url, 'callback': callback, 'before_callback_sms': before_callback_sms, 'before_callback_mail': before_callback_mail, 'after_callback_sms': after_callback_sms, 'after_callback_mail': after_callback_mail }, 'id=%s', [t.action_id] ) else: # insert action_id = Action.insert({ 'uic': uic, 'url': url, 'callback': callback, 'before_callback_sms': before_callback_sms, 'before_callback_mail': before_callback_mail, 'after_callback_sms': after_callback_sms, 'after_callback_mail': after_callback_mail }) if action_id <= 0: return jsonify(msg='insert action fail') Template.update_dict({'action_id': action_id}, 'id=%s', [t.id]) return jsonify(msg='')
def template_action_update_post(tpl_id): tpl_id = int(tpl_id) t = Template.get(tpl_id) if not t: return jsonify(msg='no such template') uic = request.form['uic'].strip() url = request.form['url'].strip() callback = request.form['callback'].strip() before_callback_sms = request.form['before_callback_sms'].strip() before_callback_mail = request.form['before_callback_mail'].strip() after_callback_sms = request.form['after_callback_sms'].strip() after_callback_mail = request.form['after_callback_mail'].strip() if t.action_id > 0: # update Action.update_dict( { 'uic': uic, 'url': url, 'callback': callback, 'before_callback_sms': before_callback_sms, 'before_callback_mail': before_callback_mail, 'after_callback_sms': after_callback_sms, 'after_callback_mail': after_callback_mail }, 'id=%s', [t.action_id]) else: # insert action_id = Action.insert({ 'uic': uic, 'url': url, 'callback': callback, 'before_callback_sms': before_callback_sms, 'before_callback_mail': before_callback_mail, 'after_callback_sms': after_callback_sms, 'after_callback_mail': after_callback_mail }) if action_id <= 0: return jsonify(msg='insert action fail') Template.update_dict({'action_id': action_id}, 'id=%s', [t.id]) return jsonify(msg='')
def update_expression(cls, expression_id, content, func, op, right_value, uic_groups, max_step, priority, note, url, callback, before_callback_sms, before_callback_mail, after_callback_sms, after_callback_mail): e = Expression.get(expression_id) if not e: return 'no such expression %s' % expression_id a = Action.get(e.action_id) if not a: return 'no relation action' Action.update_dict( { 'uic': uic_groups, 'url': url, 'callback': callback, 'before_callback_sms': before_callback_sms, 'before_callback_mail': before_callback_mail, 'after_callback_sms': after_callback_sms, 'after_callback_mail': after_callback_mail }, 'id=%s', [a.id] ) Expression.update_dict( { 'expression': content, 'func': func, 'op': op, 'right_value': right_value, 'max_step': max_step, 'priority': priority, 'note': note, }, 'id=%s', [e.id] ) return ''