def get(self, nodeid): n_obj = Node.get_by_key('n-'+str(nodeid)) if not n_obj: self.set_status(404) self.write('404') return from_id = int(self.get_argument('id', '0')) if from_id<=0 and n_obj['count']: from_id = int(n_obj['count']) to_id = from_id - EACH_PAGE_POST_NUM if to_id<0: to_id = 0 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(str(nodeid), from_id, to_id), 'newest_node': Node.get_newest(), 'recent_node': Node.get_recent_node(), 'hot_node': Node.get_hot_node(), 'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'), 'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-comment-topic-home'), }, layout='_layout.html') Node.add_node_key('n-'+str(nodeid))
def get(self, nodeid, topicid): t_key = 't-%s-%s' % (str(nodeid), str(topicid)) t_obj = Topic.get_by_key(t_key) if not t_obj or t_obj.has_key('hide'): self.set_status(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 if t_obj['cnum']: cnum = int(t_obj['cnum']) from_id = int(self.get_argument('id', '1')) if from_id > 1 and from_id % EACH_PAGE_COMMENT_NUM != 1: self.redirect('/' + t_key) return to_id = from_id + EACH_PAGE_COMMENT_NUM - 1 if to_id > cnum: to_id = cnum c_objs = Comment.get_comments(t_key, from_id, to_id) else: c_objs = None from_id = to_id = cnum = 0 self.echo('topicdetail.html', { 'title': t_obj['title'] + ' - ' + t_obj['nodename'], 'description': 'description', 't_obj': t_obj, 'c_objs': c_objs, 'from_id': from_id, 'to_id': to_id, 'cnum': cnum, 'newest_node': Node.get_newest(), 'recent_node': Node.get_recent_node(), 'hot_node': Node.get_hot_node(), 'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'), 'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-comment-topic-home'), }, layout='_layout.html')
def get(self): cur_user = self.cur_user() self.echo('notifications.html', { 'title': "站内提醒", 'topic_objs': Commomkvdb.get_notifications(cur_user['name'], cur_user.get('notic', '')), 'newest_node': Node.get_newest(), 'recent_node': Node.get_recent_node(), 'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'), 'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-comment-topic-home'), }, layout='_layout.html')
def get(self): self.echo('home.html', { 'title': "首页", 'topic_objs': Commomkvdb.get_topic_by_keys('recent-topic-home'), 'site_counts': Count.get_site_counts(), 'newest_node': Node.get_newest(), 'recent_node': Node.get_recent_node(), 'hot_node': Node.get_hot_node(), #'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'), 'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-comment-topic-home'), }, layout='_layout.html')
def get(self, nodeid, topicid): t_key = 't-%s-%s' % (str(nodeid), str(topicid)) t_obj = Topic.get_by_key(t_key) if not t_obj or t_obj.has_key('hide'): self.set_status(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 if t_obj['cnum']: cnum = int(t_obj['cnum']) from_id = int(self.get_argument('id', '1')) if from_id>1 and from_id%EACH_PAGE_COMMENT_NUM!=1: self.redirect('/'+t_key) return to_id = from_id + EACH_PAGE_COMMENT_NUM - 1 if to_id > cnum: to_id = cnum c_objs = Comment.get_comments(t_key, from_id, to_id) else: c_objs = None from_id = to_id = cnum = 0 self.echo('topicdetail.html', { 'title': t_obj['title'] + ' - ' + t_obj['nodename'], 'description':'description', 't_obj': t_obj, 'c_objs': c_objs, 'from_id': from_id, 'to_id': to_id, 'cnum': cnum, 'newest_node': Node.get_newest(), 'recent_node': Node.get_recent_node(), 'hot_node': Node.get_hot_node(), 'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'), 'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-comment-topic-home'), }, layout='_layout.html')
def get(self, nodeid): n_obj = Node.get_by_key('n-' + str(nodeid)) if not n_obj: self.set_status(404) self.write('404') return from_id = int(self.get_argument('id', '0')) if from_id <= 0 and n_obj['count']: from_id = int(n_obj['count']) to_id = from_id - EACH_PAGE_POST_NUM if to_id < 0: to_id = 0 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(str(nodeid), from_id, to_id), 'newest_node': Node.get_newest(), 'recent_node': Node.get_recent_node(), 'hot_node': Node.get_hot_node(), 'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'), 'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-comment-topic-home'), }, layout='_layout.html') Node.add_node_key('n-' + str(nodeid))
def get(self, name): name = name.lower() m_obj = Member.get_by_name(str(name)) if m_obj: self.echo('member.html', { 'title': m_obj['name'], 'm_obj': m_obj, 'topic_objs': Commomkvdb.get_topic_by_keys('topic-'+str(m_obj['name'])), 'member_comment_topic_objs': Commomkvdb.get_topic_by_keys('comment-topic-'+str(m_obj['name'])), 'newest_node': Node.get_newest(), 'recent_node': Node.get_recent_node(), 'hot_node': Node.get_hot_node(), 'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'), 'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-comment-topic-home'), }, layout='_layout.html') else: self.set_status(404) self.echo('error.html', { 'page': '404', 'title': "Can't find out this URL", 'h2': 'Oh, my god!', 'msg': 'Something seems to be lost...' })
def get(self, name): name = name.lower() m_obj = Member.get_by_name(str(name)) if m_obj: self.echo('member.html', { 'title': m_obj['name'], 'm_obj': m_obj, 'topic_objs': Commomkvdb.get_topic_by_keys('topic-' + str(m_obj['name'])), 'member_comment_topic_objs': Commomkvdb.get_topic_by_keys('comment-topic-' + str(m_obj['name'])), 'newest_node': Node.get_newest(), 'recent_node': Node.get_recent_node(), 'hot_node': Node.get_hot_node(), 'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'), 'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys( 'recent-comment-topic-home'), }, layout='_layout.html') else: self.set_status(404) self.echo( 'error.html', { 'page': '404', 'title': "Can't find out this URL", 'h2': 'Oh, my god!', 'msg': 'Something seems to be lost...' })
def get(self): self.echo( 'home.html', { 'title': "首页", 'topic_objs': Commomkvdb.get_topic_by_keys('recent-topic-home'), 'site_counts': Count.get_site_counts(), 'newest_node': Node.get_newest(), 'recent_node': Node.get_recent_node(), 'hot_node': Node.get_hot_node(), #'recent_topic_objs': Commomkvdb.get_comment_topic_by_keys('recent-topic-home'), 'comment_topic_objs': Commomkvdb.get_comment_topic_by_keys( 'recent-comment-topic-home'), }, layout='_layout.html')