本文整理汇总了Python中model.Member.get_by_name方法的典型用法代码示例。如果您正苦于以下问题:Python Member.get_by_name方法的具体用法?Python Member.get_by_name怎么用?Python Member.get_by_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Member
的用法示例。
在下文中一共展示了Member.get_by_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import get_by_name [as 别名]
def get(self, name):
name = name.lower()
m_obj = Member.get_by_name(str(name))
if m_obj:
self.echo('member.html', {
'title': m_obj['name'],
'm_obj': m_obj,
'topic_objs': Commomkvdb.get_topic_by_keys('topic-'+str(m_obj['name'])),
'member_comment_topic_objs': Commomkvdb.get_topic_by_keys('comment-topic-'+str(m_obj['name'])),
'newest_node': Node.get_newest(),
'recent_node': Node.get_recent_node(),
'hot_node': Node.get_hot_node(),
'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'),
'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-comment-topic-home'),
}, layout='_layout.html')
else:
self.set_status(404)
self.echo('error.html', {
'page': '404',
'title': "Can't find out this URL",
'h2': 'Oh, my god!',
'msg': 'Something seems to be lost...'
})
示例2: post
# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import get_by_name [as 别名]
def post(self, t_key):
t_key = str(t_key)
member = self.get_argument('member','')
if member:
clearkeys = []
for m in member.split(','):
logging.error(m)
m_obj = Member.get_by_name(str(m))
if m_obj:
if m_obj.get('notic', ''):
klist = m_obj['notic'].split(',')
else:
klist = []
if t_key not in klist:
klist.insert(0, t_key)
m_obj['notic'] = ','.join(klist[:NOTIFY_NUM])
try:
if Commomkvdb.save('m-'+str(m), m_obj):
clearkeys.append('cur_user:'+str(m))
except:
pass
if clearkeys:
clear_cache_multi(clearkeys)
self.write('test task')