def getConn(self): with self.lock: conn = self.idle_conn_queue.popleft() if conn is None: logger("there si no conn available") return None self.active_conn_queue.append(conn) return conn
def login(): try: postName = request.form["form-username"] postpassword = request.form["form-password"] resu = resume().select("*").where(username=postName).execute() if resu is None or len(resu) == 0: return jsonify({"status": 0, "msg": "用户不存在"}) if genMd5(postpassword) == resu[0].password: CurrentSession.put("user", resu[0]) if resu[0].myDomain is None or resu[0].myDomain == 'null' or len(resu[0].myDomain) == 0: resu[0].myDomain = 'setting' return jsonify({"status": 1, "msg": "登录成功", "nexturl": resu[0].myDomain}) else: return jsonify({"status": 0, "msg": "用户或密码错误"}) except: logger(format_exc()) return jsonify({"status": 0, "msg": "服务器异常"})