本文整理汇总了Python中model.zsite.Zsite.get方法的典型用法代码示例。如果您正苦于以下问题:Python Zsite.get方法的具体用法?Python Zsite.get怎么用?Python Zsite.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.zsite.Zsite
的用法示例。
在下文中一共展示了Zsite.get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from model.zsite import Zsite [as 别名]
# 或者: from model.zsite.Zsite import get [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,
)