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 api_action_get(action_id): action_id = int(action_id) a = Action.get(action_id) if not a: return jsonify(msg="no such action") return jsonify(msg='', data=a.to_json())
def expression_add_get(): g.menu = 'expressions' a = None o = Expression.get(int(request.args.get('id', '0').strip())) if o: a = Action.get(o.action_id) return render_template('expression/add.html', data={'action': a, 'expression': o, 'uic_address': UIC_ADDRESS['external']})
def expression_view_get(eid): eid = int(eid) g.menu = 'expressions' a = None o = Expression.get(eid) if o: a = Action.get(o.action_id) else: return 'no such expression' return render_template('expression/view.html', data={'action': a, 'expression': o})
def expression_view_get(eid): eid = int(eid) g.menu = "expressions" a = None o = Expression.get(eid) if o: a = Action.get(o.action_id) else: return "no such expression" return render_template("expression/view.html", data={"action": a, "expression": o}, config=config)
def expression_add_get(): g.menu = "expressions" a = None o = Expression.get(int(request.args.get("id", "0").strip())) if o: a = Action.get(o.action_id) return render_template( "expression/add.html", data={"action": a, "expression": o, "uic_address": UIC_ADDRESS["external"]}, config=config, )
def template_update_get(tpl_id): g.menu = 'templates' tpl_id = int(tpl_id) t = Template.get(tpl_id) if not t: return jsonify(msg='no such template') t.parent = Template.get(t.parent_id) ss = Strategy.select_vs(where='tpl_id = %s', params=[tpl_id], order='metric') t.action = Action.get(t.action_id) return render_template('template/update.html', data={'tpl': t, 'ss': ss, 'uic': UIC_ADDRESS['external']})
def expression_add_get(): g.menu = 'expressions' a = None o = Expression.get(int(request.args.get('id', '0').strip())) if o: a = Action.get(o.action_id) return render_template('expression/add.html', data={ 'action': a, 'expression': o, 'uic_address': UIC_ADDRESS['external'] })
def expression_view_get(eid): eid = int(eid) g.menu = 'expressions' a = None o = Expression.get(eid) if o: a = Action.get(o.action_id) else: return 'no such expression' return render_template('expression/view.html', data={ 'action': a, 'expression': o })
def expressions_get(): g.menu = "expressions" page = int(request.args.get("p", 1)) limit = int(request.args.get("limit", 6)) query = request.args.get("q", "").strip() mine = request.args.get("mine", "1") me = g.user_name if mine == "1" else None vs, total = Expression.query(page, limit, query, me) for v in vs: v.action = Action.get(v.action_id) return render_template( "expression/list.html", data={"vs": vs, "total": total, "query": query, "limit": limit, "page": page, "mine": mine}, config=config, )
def template_update_get(tpl_id): g.menu = 'templates' tpl_id = int(tpl_id) t = Template.get(tpl_id) if not t: return jsonify(msg='no such template') t.parent = Template.get(t.parent_id) ss = Strategy.select_vs(where='tpl_id = %s', params=[tpl_id], order='metric') t.action = Action.get(t.action_id) return render_template('template/update.html', data={ 'tpl': t, 'ss': ss, 'uic': UIC_ADDRESS['external'] })
def expressions_get(): g.menu = 'expressions' page = int(request.args.get('p', 1)) limit = int(request.args.get('limit', 6)) query = request.args.get('q', '').strip() mine = request.args.get('mine', '1') me = g.user_name if mine == '1' else None vs, total = Expression.query(page, limit, query, me) for v in vs: v.action = Action.get(v.action_id) return render_template('expression/list.html', data={ 'vs': vs, 'total': total, 'query': query, 'limit': limit, 'page': page, 'mine': mine, })
def expressions_get(): g.menu = 'expressions' page = int(request.args.get('p', 1)) limit = int(request.args.get('limit', 6)) query = request.args.get('q', '').strip() mine = request.args.get('mine', '1') me = g.user_name if mine == '1' else None vs, total = Expression.query(page, limit, query, me) for v in vs: v.action = Action.get(v.action_id) return render_template( 'expression/list.html', data={ 'vs': vs, 'total': total, 'query': query, 'limit': limit, 'page': page, 'mine': mine, } )
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 ''