本文整理汇总了Python中models.Person.role方法的典型用法代码示例。如果您正苦于以下问题:Python Person.role方法的具体用法?Python Person.role怎么用?Python Person.role使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Person
的用法示例。
在下文中一共展示了Person.role方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_new_user
# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import role [as 别名]
def create_new_user(self, rawname, role, email=""):
""" Creates a new Person record with a unique username, or returns a person wiht the matching username"""
ut = Utils()
username = ut.cleanUserName(rawname)
if ut.validateUserName(username):
# check for username
person = self.get_person(username)
# create a new person if we have not got this one
if person == None:
person = Person()
person.email = email
person.passhash = ""
# no passhash if not got a direct logon
person.username = username
person.displayname = ut.tidyUserName(
rawname
) # allow the username to be updated on the myHoots or profile or summink
person.before_put()
person.role = role
person.put()
self._person = person
return username
else:
return ""