本文整理汇总了Python中model.po.Po.mc_get_list方法的典型用法代码示例。如果您正苦于以下问题:Python Po.mc_get_list方法的具体用法?Python Po.mc_get_list怎么用?Python Po.mc_get_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.po.Po
的用法示例。
在下文中一共展示了Po.mc_get_list方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get_list [as 别名]
def get(self, zsite_tag_id, n=1):
tag = ZsiteTag.mc_get(zsite_tag_id)
zsite_id = self.zsite_id
user_id = self.current_user_id
cid = self.cid
is_self = zsite_id == user_id
n = int(n)
total = zsite_tag_cid_count(zsite_tag_id, cid)
page, limit, offset = page_limit_offset(
'/tag/%s'%zsite_tag_id + self.page_template,
total,
n,
PAGE_LIMIT
)
if n != 1 and offset >= total:
return self.redirect(self.page_template[:-3])
po_list = Po.mc_get_list(po_id_list_by_zsite_tag_id_cid(zsite_tag_id, cid, limit, offset))
self.render(
cid=cid,
is_self=is_self,
total=total,
li=po_list,
page=page,
tag_name=Tag.get(tag.tag_id),
back_a='/tag/%s'%zsite_tag_id
)
示例2: site_po_iter
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get_list [as 别名]
def site_po_iter(id_list, limit=MAXINT, begin_id=MAXINT):
id_list = list(merge_iter(id_list, limit, begin_id))
po_list = Po.mc_get_list(id_list)
zsite_set = set()
for i in po_list:
zsite_set.add(i.zsite_id)
zsite_set.add(i.user_id)
zsite_dict = Zsite.mc_get_dict(zsite_set)
result = []
pre_zsite_id = None
m = []
zsite_set = set()
if po_list:
last_id = po_list[-1].id
for i in po_list:
if pre_zsite_id != i.zsite_id:
if pre_zsite_id:
result.append([pre_zsite_id, m])
zsite_set.add(zsite_dict[pre_zsite_id])
m = []
pre_zsite_id = i.zsite_id
cid = i.cid
t = []
t.append(i.id)
t.append(cid)
if cid == CID_WORD:
t.append(i.htm)
else:
t.append(i.name)
if i.zsite_id != i.user_id:
user = zsite_dict[i.user_id]
t.append(user.link)
t.append(user.name)
m.append(t)
result.append([i.zsite_id, m])
zsite_set.add(zsite_dict[i.zsite_id])
else:
last_id = 0
ico_url_bind_with_default(zsite_set)
for i in result:
id = i[0]
zsite = zsite_dict[id]
i[0] = [id, zsite.name, zsite.link, zsite.ico]
return result, last_id
示例3: po_json
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get_list [as 别名]
def po_json(user_id, po_id_list, line_width):
po_id_list = map(int,po_id_list)
po_list = Po.mc_get_list(po_id_list)
txt_bind(po_list)
Zsite.mc_bind(po_list, 'user', 'user_id')
result = []
fav_dict = fav_cid_dict(
user_id,
po_id_list
)
for po in po_list:
name = po.name
user = po.user
name_len = cnenlen(name)
txt = po.txt
if txt and name_len < line_width:
tip = cnenoverflow(txt, line_width-name_len)[0]
else:
tip = ''
id = po.id
if not user:
user_id = 0
user_name = None
else:
user_id = user.id
user_name = None
result.append((
id,
name,
tip,
# user_id,
# user_name,
fav_dict[id]
))
# 0 1 2 3 4 5
# id , name, tip, author_id , author_name , is_star
return result
示例4: buzz_at_list
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get_list [as 别名]
def buzz_at_list(user_id, limit, offset):
po_id_list = []
reply_id_list = []
user_id_list = []
id_list = []
for id, from_id, po_id, reply_id in buzz_at_col_list(user_id, limit, offset):
id_list.append(id)
po_id_list.append(po_id)
reply_id_list.append(reply_id)
user_id_list.append(from_id)
from model.zsite import Zsite
from model.po import Po
from model.reply import Reply
return tuple(zip(
id_list,
Zsite.mc_get_list(user_id_list),
Po.mc_get_list(po_id_list),
Reply.mc_get_list(reply_id_list),
))
示例5: po_list_by_buzz_at_user_id
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get_list [as 别名]
def po_list_by_buzz_at_user_id(user_id):
from model.po import Po
result = BuzzAt.where(
to_id=user_id, state=BUZZ_AT_SHOW
).order_by('id desc').col_list(
32, 0, 'id, from_id, po_id, reply_id'
)
id_list = []
id2user = defaultdict(list)
for id, from_id, po_id, reply_id in result:
po_id_in = po_id in id2user
if po_id_in or len(id_list)<7:
if not po_id_in:
id_list.append(po_id)
id2user[po_id].append(from_id)
po_list = Po.mc_get_list(id_list)
return buzz_po_bind_user(po_list, [
id2user[i.id] for i in po_list
])
示例6: po_list_by_buzz_reply_user_id
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get_list [as 别名]
def po_list_by_buzz_reply_user_id(user_id):
from model.po import Po
from model.po_pos import po_pos_get_last_reply_id
from model.reply import Reply
from model.buzz_po_bind_user import buzz_po_bind_user
id_list = po_id_list_by_buzz_reply_user_id(user_id)
po_list = Po.mc_get_list(id_list)
po_user_id = []
for i in po_list:
pos = po_pos_get_last_reply_id(user_id, i.id)
new_reply_id_list = []
for reply_id in i.reply_id_list():
if reply_id > pos:
new_reply_id_list.append(reply_id)
user_id_list = []
for reply in Reply.mc_get_list(reversed(new_reply_id_list)):
user_id_list.append(reply.user_id)
po_user_id.append(user_id_list)
return buzz_po_bind_user(po_list, po_user_id, user_id)
示例7: get
# 需要导入模块: from model.po import Po [as 别名]
# 或者: from model.po.Po import mc_get_list [as 别名]
def get(self):
self.set_header('Content-Type', 'text/xml; charset=utf-8')
items = []
zsite = self.zsite
id = zsite.id
rss_title = '%s %s' % (zsite.name, host(id))
rss_link = 'http:%s/rss' % zsite.link
pubdate = time()
rss_desc = motto_get(id)
limit = 25
offset = 0
if zsite.cid == CID_SITE:
site_po_list = feed_po_list_by_zsite_id(self.current_user_id, id, CID_NOTE, limit, offset)[0]
po_id_list = []
for i in site_po_list:
po_id_list.append(i[1])
po_list = Po.mc_get_list(po_id_list)
else:
po_list = po_view_list(id, CID_NOTE, False, limit, offset)
for po in po_list:
d = {}
author = Zsite.get(po.user_id)
po_title = po.name
po_link = 'http:%s/%s' % (zsite.link, po.id)
tag = tag_by_po_id(id, po.id)[2]
title = [po_title]
if tag:
title.append('#%s#'%tag)
d['title'] = ' '.join(title)
d['author'] = author.name
d['link'] = po_link
htm = po.htm
htm = htm.replace('class="PICR"', 'style="float:right;margin-left:14px"')\
.replace('class="PICL"', 'style="float:left;margin-right:14px"')\
.replace('class="PIC"', 'style="margin:14px auto"')
desc = [
"""<font face="Verdana,sans-serif" size="3">
<pre style="font-family:Verdana;font-size:14px;white-space:pre-wrap;word-wrap:break-word;line-height:27px;">%s</pre>
""" % htm
]
unit, title = career_current(id)
desc.append(
""" <div style="padding:27px 0;text-align:left;font-size:14px;float:left"><a target="_blank" href="%s">"""%author.link
)
ico = ico_url(id)
if ico:
desc.append(
"""<img style="float:left;margin-right:28px" src="%s">"""%ico
)
desc.append("""<div style="line-height:32px;float:left"><div>%s</div><div style="color:#000">"""%escape(author.name))
if unit:
desc.append("""<div>%s</div>"""%escape(unit))
if title:
desc.append("""<div>%s</div>"""%escape(title))
desc.append("""</div></div></a></div>""")
desc.append('</font>')
d['desc'] = ''.join(desc)
d['pubdate'] = format_rfc822_data(po.create_time)
items.append(d)
self.render(
rss_title=rss_title,
rss_link=rss_link,
rss_desc=rss_desc,
pubdate=format_rfc822_data(pubdate),
items=items,
)