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')
评论列表
文章目录