本文整理汇总了Python中server.models.ssuser.SSUser.uniqueName方法的典型用法代码示例。如果您正苦于以下问题:Python SSUser.uniqueName方法的具体用法?Python SSUser.uniqueName怎么用?Python SSUser.uniqueName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.models.ssuser.SSUser
的用法示例。
在下文中一共展示了SSUser.uniqueName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: isValid
# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import uniqueName [as 别名]
def isValid(self, data):
if not data.get("email"):
return (False, "Please specify your email address.", NoEmailError)
userName = data.get("userName")
if not userName:
return (False, "Please enter a user name.", MissingUserNameError)
if len(userName) < 0:
return (False, "Your user name should be at least 1 character long.", ShortUserNameError)
if not SSUser.uniqueName(userName):
return (False, "That user name is taken, please choose another.", UserNameAlreadyExistsError)
if not data.get("password"):
return (False, "Please supply a password.", MissingPasswordError)
if not data.get("passwordVerify"):
return (False, "Please enter your password twice.", MissingPasswordVerifyError)
if data.get("password") != data.get("passwordVerify"):
return (False, "Passwords do not match.", PasswordMatchError)
return (True, data, None)