本文整理汇总了Python中user.models.User.host方法的典型用法代码示例。如果您正苦于以下问题:Python User.host方法的具体用法?Python User.host怎么用?Python User.host使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.models.User
的用法示例。
在下文中一共展示了User.host方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_host
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import host [as 别名]
def check_host(host):
'''
Check we are running on the correct host
see the notes about the use of flock();
and the affects of lockf();
'''
assert User.host() == host, "AberMUD is only available on {}, not on {}".format(host, User.host())
示例2: login
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import host [as 别名]
def login(username=None):
'''
Does all the login stuff
The whole login system is called from this
'''
# Check if banned first
b = User.chkbnid(User.host())
# cuserid(NULL));
logger.debug("BANNED %d", b)
if username:
username = username.lower()
user = User.by_username(username)
if user:
authenticate(user)
return user
# Get the user name
user = None
while not user:
user = input_username(username)
username = ''
if user.id:
# Password checking
authenticate(user)
else:
register(user)
cls()
return user