Esempio n. 1
0
def delete(username):
    (flag, msg) = deleteUser(username)
    if not flag:
        print "Error: ", msg
    else:
        print msg
Esempio n. 2
0
        elif o in ("-p", "--password"):
            password = str(a)
            isControl = False
        elif o in ("-d", "--delete"):
            user = str(a)
            isDelete = True
            isControl = False
        elif o in ("-s", "--show"):
            listUsers()
            sys.exit()
        elif o in ("-c",):
            control()
            sys.exit()
        else:
            assert False, "unhandled option"

    if isControl:
        control()
        sys.exit()

    if isDelete:
        (flag, msg) = deleteUser(user)
        if not flag:
            print "Error: ", msg
        else:
            print msg
    else:
        if user is None or password is None:
            print "Error: ", "please input -u xxx -p ******"
            sys.exit()
        add(user, password)