本文整理汇总了Python中output.Output.storeData方法的典型用法代码示例。如果您正苦于以下问题:Python Output.storeData方法的具体用法?Python Output.storeData怎么用?Python Output.storeData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类output.Output
的用法示例。
在下文中一共展示了Output.storeData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import storeData [as 别名]
def build(self, rss=False):
if rss:
self.site.rss_url = '/rss.xml'
fg = FeedGenerator()
fg.title(self.site.name)
fg.author({'name': self.site.author})
fg.link(href=self.site.base_url, rel='alternate')
fg.subtitle(self.site.description)
start = time.time()
getLogger().info("Copy Assets")
self.output.copyAssets(self.basedir)
getLogger().info("Start Build of static content")
posts = []
for p in self.source.getPosts():
if not p.published:
getLogger().info("Ingnoring draft Post %s (%s)", p.title, p.slug)
continue
posts.append(p)
if rss:
fe = fg.add_entry()
fe.id("%s/%s" % (self.site.base_url, p.permalink))
fe.link(href=fe.id(), rel='alternate')
fe.title(p.title)
fe.published(p.created_at.replace(tzinfo=pytz.timezone(self.site.timezone)))
category = []
for t in p.tags:
category.append({'term': t})
fe.category(category)
fe.content(p.content)
Output.storeData(os.path.join(self.basedir, p.permalink), self.output.render(self.site, post=p))
getLogger().debug("Adding Post \"%s\" (%s)", p.title, p.slug)
posts = sorted(posts, key=lambda k: k.created_at, reverse=True)
Output.storeData(os.path.join(self.basedir, 'index.html'), self.output.render(self.site, posts=posts, post=None, is_home=True, pagination=None))
if rss:
Output.storeData(os.path.join(self.basedir, 'rss.xml'), fg.rss_str(pretty=True))
getLogger().debug("You awesome RSS feed has been generated")
getLogger().info("It took %d seconds to generate your awesome blog" % (time.time() - start))