本文整理汇总了Python中point.core.user.User.check_subscriber方法的典型用法代码示例。如果您正苦于以下问题:Python User.check_subscriber方法的具体用法?Python User.check_subscriber怎么用?Python User.check_subscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类point.core.user.User
的用法示例。
在下文中一共展示了User.check_subscriber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: info
# 需要导入模块: from point.core.user import User [as 别名]
# 或者: from point.core.user.User import check_subscriber [as 别名]
def info(login):
try:
user = User("login", login)
except UserNotFound:
raise NotFound
try:
data = users.info(user)
except SubscribeError:
raise Forbidden
data["id"] = user.id
data["login"] = user.login
try:
data["created"] = data["created"]
except (KeyError, AttributeError):
pass
try:
data["birthdate"] = data["birthdate"]
except (KeyError, AttributeError):
pass
if env.user.id:
data["subscribed"] = user.check_subscriber(env.user)
data["rec_sub"] = user.check_rec_subscriber(env.user)
if not data["subscribed"]:
data["bl"] = env.user.check_blacklist(user)
if not data["bl"]:
data["wl"] = env.user.check_blacklist(user)
return data
示例2: unsubscribe_rec
# 需要导入模块: from point.core.user import User [as 别名]
# 或者: from point.core.user.User import check_subscriber [as 别名]
def unsubscribe_rec(login):
if isinstance(login, User):
user = login
else:
user = User('login', login)
if not user.check_subscriber(env.user):
return False
user.del_rec_subscriber(env.user)
示例3: subscribe_rec
# 需要导入模块: from point.core.user import User [as 别名]
# 或者: from point.core.user.User import check_subscriber [as 别名]
def subscribe_rec(login):
"""Subscribe to user's recommendations
returns True if subscribed, and False if subscription request is sent
"""
if isinstance(login, User):
user = login
else:
user = User('login', login)
if env.user.id == user.id:
raise SubscribeError
if not user.check_subscriber(env.user):
return subscribe(user)
user.add_rec_subscriber(env.user)
return True