コード例 #1
0
ファイル: blog.py プロジェクト: yangzilong1986/saepy-log
    def get(self, name = ''):
        if not name:
            print 'ArchiveDetail name null'
            name = Archive.get_latest_archive_name()

        objs = Archive.get_archive_page_posts(name, 1)

        archiveobj = Archive.get_archive_by_name(name)
        if archiveobj:
            pass
        else:
            self.redirect(BASE_URL)
            return

        allpost =  archiveobj.id_num
        allpage = allpost/EACH_PAGE_POST_NUM
        if allpost%EACH_PAGE_POST_NUM:
            allpage += 1

        output = self.render('index.html', {
            'title': "%s - %s"%( archiveobj.name, getAttr('SITE_TITLE')),
            'keywords':archiveobj.name,
            'description':getAttr('SITE_DECR'),
            'objs': objs,
            'cats': Category.get_all_cat_name(),
            'tags': Tag.get_hot_tag_name(),
            'archives': Archive.get_all_archive_name(),
            'page': 1,
            'allpage': allpage,
            'listtype': 'archive',
            'name': name,
            'namemd5': md5(name.encode('utf-8')).hexdigest(),
            'comments': Comment.get_recent_comments(),
            'links':Link.get_all_links(),
            'isauthor':self.isAuthor(),
            'Totalblog':get_count('Totalblog',NUM_SHARDS,0),
        },layout='_layout.html')
        self.write(output)
        return output
コード例 #2
0
ファイル: blog.py プロジェクト: yobin/saepy-log
    def get(self, name=''):
        if not name:
            name = Archive.get_latest_archive_name()
        objs = Archive.get_archive_page_posts(name, 1)
        archiveobj = Archive.get_archive_by_name(name)
        if archiveobj:
            if MYSQL_TO_KVDB_SUPPORT:
                allpost = len(archiveobj.split(','))
            else:
                allpost = archiveobj.id_num
        else:
            return self.redirect(BASE_URL)

        allpage = allpost / EACH_PAGE_POST_NUM
        if allpost % EACH_PAGE_POST_NUM:
            allpage += 1

        output = self.render(
            'index.html', {
                'title': "%s - %s" % (name, getAttr('SITE_TITLE')),
                'keywords': name,
                'description': getAttr('SITE_DECR'),
                'objs': objs,
                'cats': Category.get_all_cat_name(),
                'tags': Tag.get_hot_tag_name(),
                'archives': Archive.get_all_archive_name(),
                'page': 1,
                'allpage': allpage,
                'listtype': 'archive',
                'name': name,
                'namemd5': md5(name.encode('utf-8')).hexdigest(),
                'comments': Comment.get_recent_comments(),
                'links': Link.get_all_links(),
                'isauthor': self.isAuthor(),
                'Totalblog': get_count('Totalblog', NUM_SHARDS, 0),
            },
            layout='_layout.html')
        self.write(output)
        return output