public.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Windless 作者: chiaki64 项目源码 文件源码
def get(self):
        id = self.match['id']
        if id.isdigit() is False:
            raise web.HTTPNotFound()
        data = await self.redis.get('Article', id)
        if data is None:
            raise web.HTTPNotFound()

        # ????
        data['created_date'] = todate(data['created_time'], '%Y-%m-%d %H:%M:%S')
        data['updated_date'] = todate(data['updated_time'], '%Y-%m-%d %H:%M:%S')
        # ??
        try:
            data['citations'] = [render(item)[3:-5] for item in data.get('citation').split('|')]
        except AttributeError:
            data['citations'] = []
        data['tags'] = [item for item in data.get('tag').split('|')]

        if len(re.findall('[$]{1,2}', data['text'])) > 0:
            math = True
        else:
            math = False
        return geass({
            'article': data,
            'math': math,
            'PAGE_IDENTIFIER': self.request.app.router['article'].url(
                parts={'id': id}
            ),
            'dev': not config.dev,
            'comment': True
        }, self.request, 'public/article.html')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号