当前位置: 首页>>代码示例>>Python>>正文


Python Comment.get_recent_comments方法代码示例

本文整理汇总了Python中model.Comment.get_recent_comments方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.get_recent_comments方法的具体用法?Python Comment.get_recent_comments怎么用?Python Comment.get_recent_comments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.Comment的用法示例。


在下文中一共展示了Comment.get_recent_comments方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import get_recent_comments [as 别名]
 def get(self, direction = 'next', page = '2', base_id = '1'):
     if page == '1':
         self.redirect(BASE_URL)
         return
     objs = Article.get_page_posts(direction, page, base_id)
     if objs:
         if direction == 'prev':
             objs.reverse()            
         fromid = objs[0].id
         endid = objs[-1].id
     else:
         fromid = endid = ''
     
     allpost =  Article.count_all_post()
     allpage = allpost/EACH_PAGE_POST_NUM
     if allpost%EACH_PAGE_POST_NUM:
         allpage += 1
     output = self.render('index.html', {
         'title': "%s - %s | Part %s"%(SITE_TITLE,SITE_SUB_TITLE, page),
         'keywords':KEYWORDS,
         'description':SITE_DECR,
         'objs': objs,
         'cats': Category.get_all_cat_name(),
         'tags': Tag.get_hot_tag_name(),
         'page': int(page),
         'allpage': allpage,
         'listtype': 'index',
         'fromid': fromid,
         'endid': endid,
         'comments': Comment.get_recent_comments(),
         'links':Link.get_all_links(),
     },layout='_layout.html')
     self.write(output)
     return output
开发者ID:bibodeng,项目名称:pyWeiXin_SAElog,代码行数:36,代码来源:blog.py

示例2: get

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import get_recent_comments [as 别名]
    def get(self, name = ''):
        objs = Category.get_cat_page_posts(name, 1)

        catobj = Category.get_cat_by_name(name)
        if catobj:
            pass
        else:
            self.redirect(BASE_URL)
            return

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

        output = self.render('index.html', {
            'title': "%s - %s"%( catobj.name, getAttr('SITE_TITLE')),
            'keywords':catobj.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': 'cat',
            '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
开发者ID:yangzilong1986,项目名称:saepy-log,代码行数:37,代码来源:blog.py

示例3: get

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import get_recent_comments [as 别名]
    def get(self, listtype = '', direction = 'next', page = '1', name = ''):
        if listtype == 'cat':
            objs = Category.get_cat_page_posts(name, page)
            catobj = Category.get_cat_by_name(name)
        elif listtype == 'tag':
            objs = Tag.get_tag_page_posts(name, page)
            catobj = Tag.get_tag_by_name(name)
        elif listtype == 'archive':
            objs = Archive.get_archive_page_posts(name, page)
            catobj = Archive.get_archive_by_name(name)
        #
        if not catobj:
            return self.redirect(BASE_URL)

        if not objs:
            return self.redirect(BASE_URL)

        if MYSQL_TO_KVDB_SUPPORT:
            allpost =  len(catobj.split(','))
        else:
            allpost =  catobj.id_num
        allpage = allpost/EACH_PAGE_POST_NUM
        if allpost%EACH_PAGE_POST_NUM:
            allpage += 1

        output = self.render('index.html', {
            'title': "%s - %s | Part %s"%( name, getAttr('SITE_TITLE'), page),
            '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': int(page),
            'allpage': allpage,
            'listtype': listtype,
            '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
开发者ID:yobin,项目名称:saepy-log,代码行数:47,代码来源:blog.py

示例4: get

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import get_recent_comments [as 别名]
 def get(self, id = ''):
     obj = None
     if id:
         obj = Comment.get_comment_by_id(id)
         if obj:
             act = self.get_argument("act",'')
             if act == 'del':
                 Comment.del_comment_by_id(id)
                 clear_cache_by_pathlist(['post:%d'%obj.postid])
                 self.redirect('%s/admin/comment/'% (BASE_URL))
                 return
     self.echo('admin_comment.html', {
         'title': "管理评论",
         'cats': Category.get_all_cat_name(),
         'tags': Tag.get_all_tag_name(),
         'obj': obj,
         'comments': Comment.get_recent_comments(),
     },layout='_layout_admin.html')
开发者ID:cylinderlee,项目名称:saepy-log,代码行数:20,代码来源:admin.py

示例5: get

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import get_recent_comments [as 别名]
 def get(self, id=""):
     obj = None
     if id:
         obj = Comment.get_comment_by_id(id)
         if obj:
             act = self.get_argument("act", "")
             if act == "del":
                 Comment.del_comment_by_id(id)
                 if MYSQL_TO_KVDB_SUPPORT:
                     clear_cache_by_pathlist(["post:%d" % obj["postid"]])
                 else:
                     clear_cache_by_pathlist(["post:%d" % obj.postid])
                 self.redirect("%s/admin/comment/" % (BASE_URL))
                 return
     self.echo(
         "admin_comment.html",
         {"title": "管理评论", "obj": obj, "comments": Comment.get_recent_comments(ADMIN_RECENT_COMMENT_NUM)},
         layout="_layout_admin.html",
     )
开发者ID:yobin,项目名称:saepy-log,代码行数:21,代码来源:admin.py

示例6: get

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import get_recent_comments [as 别名]
 def get(self, id=""):
     obj = None
     if id:
         obj = Comment.get_comment_by_id(id)
         if obj:
             act = self.get_argument("act", "")
             if act == "del":
                 Comment.del_comment_by_id(id)
                 clear_cache_by_pathlist(["post:%d" % obj.postid])
                 self.redirect("%s/admin/comment/" % (BASE_URL))
                 return
     self.echo(
         "admin_comment.html",
         {
             "title": "管理评论",
             "cats": Category.get_all_cat_name(),
             "tags": Tag.get_all_tag_name(),
             "obj": obj,
             "comments": Comment.get_recent_comments(),
         },
         layout="_layout_admin.html",
     )
开发者ID:biggtfish,项目名称:pyWeiXin_SAElog,代码行数:24,代码来源:admin.py


注:本文中的model.Comment.get_recent_comments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。