Python Google应用程序引擎错误:uu init_uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu;要求';
我正在做一个关于谷歌应用程序引擎的教程,我发现了这个错误:Python Google应用程序引擎错误:uu init_uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu;要求';,python,python-2.7,google-app-engine,Python,Python 2.7,Google App Engine,我正在做一个关于谷歌应用程序引擎的教程,我发现了这个错误: ERROR 2016-08-27 17:41:18,545 webapp2.py:1552] __init__() got an unexpected keyword argument 'require' 我不知道这是什么要求,也不知道这意味着什么。请建议。谢谢 我打电话时会发生这种情况: 控制器: json_response = Users.add_new_user(name, email, password) 型号: cl
ERROR 2016-08-27 17:41:18,545 webapp2.py:1552] __init__() got an unexpected keyword argument 'require'
我不知道这是什么要求,也不知道这意味着什么。请建议。谢谢
我打电话时会发生这种情况:
控制器:
json_response = Users.add_new_user(name, email, password)
型号:
class Users(db.Model):
name = db.StringProperty(required = True)
email = db.StringProperty(required = True)
password = db.StringProperty(require = True)
confirmation_code = db.StringProperty(required = True)
confirmed_email = db.BooleanProperty(default = False)
@classmethod
def check_if_exists(cls, email):
return cls.query(cls.email == email).get()
@classmethod
def add_new_user(cls, name, email, password):
user = cls.check_if_exists(email)
if not user:
random_bytes = urandom(64)
salt = b64encode(random_bytes).decode('utf-8')
hashed_password = salt + sha256(salt + password).hexdigest()
confirmation_code = str(uuid.uuid4().get_hex())
new_user_key = cls(
name=name,
email=email,
password=hashed_password,
confirmation_code=confirmation_code
).put()
print(new_user_key)
return {
'created': True,
'user_id': new_user_key.id(),
'confirmation_code':confirmation_code
}
else:
return {
'created': False,
'title': 'This email is already in use',
'message': 'Please log in if this is your email account. '
}
您有一个输入错误:
require
而不是required
:
password = db.StringProperty(require = True)
您有一个输入错误:
require
而不是required
:
password = db.StringProperty(require = True)
请添加堆栈跟踪请添加堆栈跟踪日志非常好。如错误中所述快速搜索
require
将显示该行。日志非常好。如错误中所述快速搜索require
将显示该行。