Esempio n. 1
0
def do_action(pn, action):
    df = dogfoodproduct(pn)
    username = request.args.get("u", "")
    if df.is_user_enable(username):
        df.record_action(username, action)
        return "OK"
    return "user not enable"
Esempio n. 2
0
 def _dec(*args, **kw):
     pn = kw["pn"]
     print pn
     df = dogfoodproduct(pn)
     print df
     if df is None:
         return json.dumps({"ret": -1})
     return func(*args, **kw)
Esempio n. 3
0
def do_add(pn):
    df = dogfoodproduct(pn)
    names = request.form.get("u", "")
    names = names.split("\n")
    cnt = 0
    for name in names:
        if df.add_user(name.rstrip().lstrip()):
            cnt += 1
    return json.dumps({"ret": cnt})
Esempio n. 4
0
def do_remove(pn):
    df = dogfoodproduct(pn)
    uname = request.args.get("u", "")
    df.toggle_user_enable_status(uname)
    return json.dumps({"ret": 1})
Esempio n. 5
0
def do_add(pn):
    df = dogfoodproduct(pn)
    if df.add_user(request.form.get("u", None)):
        return json.dumps({"ret": 1})
    return json.dumps({"ret": -1})
Esempio n. 6
0
def do_list(pn):
    df = dogfoodproduct(pn)
    items = df.get_users()
    return json.dumps(items)
Esempio n. 7
0
def do_get_action_list(pn, action):
    df = dogfoodproduct(pn)
    return json.dumps(df.get_action_list(action))
Esempio n. 8
0
def do_check(pn):
    df = dogfoodproduct(pn)
    if df.is_user_enable(request.args.get("u", "")):
        return json.dumps({"ret": 1})
    return json.dumps({"ret": -1})
Esempio n. 9
0
def do_delete(pn):
    df = dogfoodproduct(pn)
    uname = request.args.get("u", "")
    if df.delete_user(uname):
        return json.dumps({"ret": 1})
    return json.dumps({"ret": 0})