def POST(self): name = xutils.get_argument("name") password = xutils.get_argument("password") xauth.add_user(name, password) added = xauth.get_user(name) xutils.log("Add user {}", added) # 先暴力解决 xmanager.reload() raise web.seeother("/system/user?name=" + name)
def POST(self): name = xutils.get_argument("name") password = xutils.get_argument("password") xauth.add_user(name, password) added = xauth.get_user(name) xutils.log("Add user {}", added) # 先暴力解决 xmanager.reload() return self.GET()
def POST(self): args = web.input() name = args.name password = args.password xauth.add_user(name, password) added = xauth.get_user(name) print(" -- User -- ", added) # 先暴力解决 xmanager.reload() return self.GET()
def POST(self): name = xutils.get_argument("name") result = xauth.add_user(name, textutil.random_string(6)) if result["code"] == "success": # 重新加载系统 xmanager.reload() return result
def POST(self): name = xutils.get_argument("name") password = xutils.get_argument("password") error = xauth.add_user(name, password) added = xauth.get_user(name) # 先暴力解决 xmanager.reload() raise web.seeother("/system/user?name=%s" % name)
def POST(self): name = xutils.get_argument("name") error = xauth.add_user(name, textutil.random_string(6)) if error is None: # 先暴力解决 xmanager.reload() return dict(code="success") else: return error
def test_add_and_remove_user(self): # 创建用户 result = xauth.add_user("u123456", "123456") print(result) users = xauth.refresh_users() print(users) self.assertEqual(2, len(users)) # 删除用户 xauth.remove_user("u123456") check = xauth.find_by_name("u123456") self.assertEqual(None, check)
def test_add_user(self): xauth.add_user("u123456", "123456") users = xauth.refresh_users() self.assertEqual(2, len(users))