本文整理汇总了Python中model.Member.get_by_key_name方法的典型用法代码示例。如果您正苦于以下问题:Python Member.get_by_key_name方法的具体用法?Python Member.get_by_key_name怎么用?Python Member.get_by_key_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Member
的用法示例。
在下文中一共展示了Member.get_by_key_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cur_user
# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import get_by_key_name [as 别名]
def cur_user(self):
if self.request.user:
from model import Member, GoogleUser
req_user = self.request.user
gu_obj = GoogleUser.get_or_insert(req_user.user_id())
if gu_obj.name:
return Member.get_by_key_name(gu_obj.name)
return None
else:
return None
示例2: set_mentions
# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import get_by_key_name [as 别名]
def set_mentions(topic_key,allmember):
for m in allmember.split(','):
m_obj = Member.get_by_key_name(m)
if m_obj:
if m_obj.notic:
t_list = m_obj.notic.split(',')
if topic_key not in t_list:
t_list.insert(0, topic_key)
m_obj.notic = ','.join(t_list[:NOTIFY_NUM])
m_obj.put()
else:
m_obj.notic = topic_key
m_obj.put()
示例3: get
# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import get_by_key_name [as 别名]
def get(self):
if self.cur_user and self.cur_user.flag==99:
m_name = self.request.get('name')
m_obj = None
if m_name:
m_obj = Member.get_by_key_name(m_name)
self.echo('setuserflag.html', {
'title': "设置用户权限",
'm_name': m_name,
'm_obj':m_obj,
}, layout='_layout.html')
else:
self.error(403)
self.write('403:forbidden')
示例4: post
# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import get_by_key_name [as 别名]
def post(self):
if self.cur_user and self.cur_user.flag==99:
m_name = self.request.get('name')
flag = self.request.get('flag')
m_obj = None
if m_name and flag:
m_obj = Member.get_by_key_name(m_name)
if m_obj:
m_obj.flag = int(flag)
m_obj.put()
else:
self.redirect('/set-user-flag')
return
self.redirect('/set-user-flag?name=%s'%str(m_name))
else:
self.error(403)
self.write('403:forbidden')