本文整理汇总了Python中model.User.User.new方法的典型用法代码示例。如果您正苦于以下问题:Python User.new方法的具体用法?Python User.new怎么用?Python User.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.User.User
的用法示例。
在下文中一共展示了User.new方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import new [as 别名]
def post(self):
username = self.request.get('username')
password = self.request.get('password')
verify = self.request.get('verify')
email = self.request.get('email')
usrerror = pwderror = verifyerror = emailerror = ""
usr = User()
if not valid_username(username):
usrerror = "Invalid Username!"
if not valid_password(password):
pwderror = "invalid Password!"
if not valid_email(email) and email != '':
emailerror = 'Invalid Email!'
if password != verify:
verifyerror = "Passwords don't match!"
if usr.by_name(username):
usrerror= "Username already in use!"
if usrerror or pwderror or verifyerror or emailerror:
self.formpost(username, usrerror, pwderror, verifyerror, email, emailerror)
return None
else:
usr.new(username, password, email)
self.set_user_cookie(username)
self.redirect("/")