Ejemplo n.º 1
0
 def get(self, nodeid):
     n_obj = Node.get_by_id(int(nodeid))
     if not n_obj:
         self.error(404)
         self.echo('error.html', {
             'page': '404',
             'title': "Can't find out this URL",
             'h2': 'Oh, my god!',
             'msg': 'Something seems to be lost...'
         })
         return
     
     from_id = int(self.request.get('id', '0'))
     if from_id<=0 and n_obj.count:
         from_id = n_obj.count
     
     to_id = from_id - EACH_PAGE_POST_NUM
     if to_id<0:
         to_id = 0
     
     newest_node = Node.get_newest()
     self.echo('nodedetail.html', {
         'title': n_obj.name,
         'n_obj': n_obj,
         'from_id': from_id,
         'to_id': to_id,
         'topic_objs': Node.get_page_topic(nodeid, from_id, to_id),
         'newest_node': newest_node,
         'recent_node': Node.get_recent_node(),
         'hot_node': Node.get_hot_node(),
         'recent_topic_objs': KeyStrValue.get_topic_key_title('recent-topic-home'),
         'reply_topic_objs': KeyStrValue.get_topic_key_title('recent-reply-topic'),            
     }, layout='_layout.html')
     if len(newest_node)==10:
         KeyStrValue.add_node_key(nodeid)