def get(self, topic_id):
'''
?????
'''
topic = dict()
tid = ObjectId(topic_id)
topic = yield self.db.topic.find_one({
'_id': tid
})
if topic is None:
self.custom_error()
isfavorite = False
current_user = self.current_user
topic['content'] = markdown.markdown(topic['content'])
isfavorite = False
if current_user:
user = yield self.db.user.find_one({
'_id': ObjectId(current_user['_id'])
})
if topic['_id'] in user['favorite']:
isfavorite = True
self.render('topic/template/topic-detail.html',
topic=topic, isfavorite=isfavorite)
评论列表
文章目录