本文整理汇总了Python中model.User.User.getLevelBlockUser方法的典型用法代码示例。如果您正苦于以下问题:Python User.getLevelBlockUser方法的具体用法?Python User.getLevelBlockUser怎么用?Python User.getLevelBlockUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.User.User
的用法示例。
在下文中一共展示了User.getLevelBlockUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import getLevelBlockUser [as 别名]
def post(self, level_id):
user = User.getLevelBlockUser(users.get_current_user())
if user:
level = self.request.get('level')
name = self.request.get('name')
if level_id:
l = Level.getById(int(level_id))
#only modify if you are the original author
if l.user.id == user.key.id:
l.name = name
l.user = user.key
l.score = 0
l.published = False
l.level = str(level)
l.put()
else:
l = Level()
l.name = name
l.user = user.key
l.score = 0
l.published = False
l.level = str(level)
l.put()
self.response.out.write(level)
else:
template_values = {
'signinurl': users.create_login_url("/")
}
template = jinja_environment.get_template('signin.html')
self.response.out.write(template.render(template_values))
示例2: get
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import getLevelBlockUser [as 别名]
def get(self):
user = User.getLevelBlockUser(users.get_current_user())
#checks to see if we have a user signed in
if user:
template_values = {
'levels' : Level.getUserLevels(user.key),
'currentuser': user.nickname
}
template = jinja_environment.get_template('userlevels.html')
self.response.out.write(template.render(template_values))
#if not is ask them to sign in
else:
template_values = {
'signinurl' : users.create_login_url("/")
}
template = jinja_environment.get_template('signin.html')
self.response.out.write(template.render(template_values))