本文整理汇总了Python中user.User.current_id方法的典型用法代码示例。如果您正苦于以下问题:Python User.current_id方法的具体用法?Python User.current_id怎么用?Python User.current_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.current_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addTrack
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import current_id [as 别名]
def addTrack():
l = Location.from_id(request.form["location_id"])
uid = User.current_id()
if User.is_admin() and request.form["special"] == "true":
special = 1
uid = 29 #MAGIC NUMBER!!! This is the ID of the MSS user on the server
else:
special = 0
ret = l.add_track(request.form["provider_id"], uid, special)
return ret
示例2: vote
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import current_id [as 别名]
def vote(self, pli_id, direc):
if not "voted_arr" in session: session["voted_arr"] = []
voted = session["voted_arr"]
if User.is_admin() or not pli_id in voted:
v = Vote(playlist_item_id=pli_id, user_id=User.current_id(), direction=direc)
v.save()
voted.append(pli_id)
session["voted_arr"] = voted
self.update_subscribers()
return common.buildDialogResponse("Thanks for the input!", 200)
else:
return common.buildDialogResponse("Nice try sucka! You already voted", 409)
示例3: decorated_function
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import current_id [as 别名]
def decorated_function(*args, **kwargs):
if User.current_id() is None:
return common.buildDialogResponse("Please log in.", 401)
return f(*args, **kwargs)