• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python core_tab.CabPost类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中torlite.model.core_tab.CabPost的典型用法代码示例。如果您正苦于以下问题:Python CabPost类的具体用法?Python CabPost怎么用?Python CabPost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: update

    def update(self, uid, post_data, update_time=False):

        cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        try:
            if update_time:
                entry2 = CabPost.update(
                    time_update=time.time()
                ).where(CabPost.uid == uid)
                entry2.execute()
        except:
            pass

        try:
            entry = CabPost.update(
                title=post_data['title'][0],
                cnt_html=cnt_html,
                user_name=post_data['user_name'],
                cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
                logo=post_data['logo'][0],
                keywords=post_data['keywords'][0],
            ).where(CabPost.uid == uid)
            entry.execute()
        except:
            return  False
开发者ID:vaveee,项目名称:TorCMS,代码行数:25,代码来源:mpost.py


示例2: get_by_wiki

 def get_by_wiki(self, citiao):
     tt = CabPost.select().where(CabPost.title == citiao).count()
     if tt == 0:
         return None
     else:
         self.update_view_count(citiao)
         return CabPost.get(CabPost.title == citiao)
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:7,代码来源:mpost.py


示例3: query_cat_random

 def query_cat_random(self, cat_id, num=6):
     if cat_id == '':
         return self.query_random(num)
     if config.dbtype == 1 or config.dbtype == 3:
         return CabPost.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
             peewee.fn.Random()).limit(num)
     elif config.dbtype == 2:
         return CabPost.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
             peewee.fn.Rand()).limit(num)
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:9,代码来源:mpost.py


示例4: insert_data

    def insert_data(self, id_post, post_data):

        uu = self.get_by_id(id_post)
        if uu is None:
            pass
        else:
            return (False)
        if 'id_spec' in post_data:
            id_spec = post_data['id_spec'][0]
        else:
            id_spec = 0
        if 'src_type' in post_data and post_data['src_type'][0] == '1':
            cnt_html = tools.rst2html(post_data['cnt_md'][0])
        else:
            cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        entry = CabPost.create(
            title=post_data['title'][0],
            date=datetime.datetime.now(),
            cnt_html=cnt_html,
            uid=id_post,
            time_create=time.time(),
            user_name=post_data['user_name'],
            cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
            time_update=time.time(),
            view_count=1,
            id_spec=id_spec,
            logo=post_data['logo'][0],
            keywords=post_data['keywords'][0],
            src_type=post_data['src_type'][0] if ('src_type' in post_data) else 0
        )
        return (entry.uid)
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:32,代码来源:mpost.py


示例5: update_view_count_by_uid

 def update_view_count_by_uid(self, uid):
     entry = CabPost.update(view_count=CabPost.view_count + 1).where(CabPost.uid == uid)
     try:
         entry.execute()
         return True
     except:
         return False
开发者ID:vaveee,项目名称:TorCMS,代码行数:7,代码来源:mpost.py


示例6: get_previous_record

 def get_previous_record(self, in_uid):
     current_rec = self.get_by_id(in_uid)
     query = CabPost.select().where(CabPost.time_update > current_rec.time_update).order_by(CabPost.time_update)
     if query.count() == 0:
         return None
     else:
         return query.get()
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:7,代码来源:mpost.py


示例7: update

    def update(self, uid, post_data, update_time=False):

        if 'id_spec' in post_data:
            id_spec = post_data['id_spec'][0]
        else:
            id_spec = 0

        if 'src_type' in post_data and post_data['src_type'][0] == '1':
            cnt_html = tools.rst2html(post_data['cnt_md'][0])
        else:
            cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        if update_time:
            entry = CabPost.update(
                title=post_data['title'][0],
                date=datetime.datetime.now(),
                cnt_html=cnt_html,
                user_name=post_data['user_name'],
                cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
                time_update=time.time(),
                id_spec=id_spec,
                logo=post_data['logo'][0],
                keywords=post_data['keywords'][0],
                src_type=post_data['src_type'][0] if ('src_type' in post_data) else 0
            ).where(CabPost.uid == uid)
        else:
            entry = CabPost.update(
                title=post_data['title'][0],
                cnt_html=cnt_html,
                user_name=post_data['user_name'],
                cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
                id_spec=id_spec,
                logo=post_data['logo'][0],
                keywords=post_data['keywords'][0],
                src_type=post_data['src_type'][0] if ('src_type' in post_data) else 0
            ).where(CabPost.uid == uid)
        entry.execute()
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:37,代码来源:mpost.py


示例8: insert_data

    def insert_data(self, id_post, post_data):

        uu = self.get_by_id(id_post)
        if uu is None:
            pass
        else:
            return (False)

        cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        entry = CabPost.create(
            title=post_data['title'][0],
            date=datetime.datetime.now(),
            cnt_html=cnt_html,
            uid=id_post,
            time_create=time.time(),
            user_name=post_data['user_name'],
            cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
            time_update=time.time(),
            view_count=1,
            logo=post_data['logo'][0],
            keywords=post_data['keywords'][0],
        )
        return (entry.uid)
开发者ID:vaveee,项目名称:TorCMS,代码行数:24,代码来源:mpost.py


示例9: query_most

 def query_most(self, num=8):
     return CabPost.select().order_by(CabPost.view_count.desc()).limit(num)
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:2,代码来源:mpost.py


示例10: query_cat_recent

 def query_cat_recent(self, cat_id, num=8):
     return CabPost.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
         CabPost.time_update.desc()).limit(num)
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:3,代码来源:mpost.py


示例11: query_recent_most

 def query_recent_most(self, num=8, recent=30):
     time_that = int(time.time()) - recent * 24 * 3600
     return CabPost.select().where(CabPost.time_update > time_that).order_by(CabPost.view_count.desc()).limit(num)
开发者ID:daimon99,项目名称:TorCMS,代码行数:3,代码来源:mpost.py


示例12: delete_last_post

 def delete_last_post(self):
     #Todo: delete
     query = CabPost.select().order_by(  CabPost.time_update.desc()).limit(1).get()
     self.delete(query.uid)
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:4,代码来源:mpost.py


示例13: update_view_count_by_uid

 def update_view_count_by_uid(self, uid):
     entry = CabPost.update(view_count=CabPost.view_count + 1).where(CabPost.uid == uid)
     entry.execute()
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:3,代码来源:mpost.py


示例14: query_all

 def query_all(self):
     return CabPost.select()
开发者ID:daimon99,项目名称:TorCMS,代码行数:2,代码来源:mpost.py


示例15: query_pager_by_slug

 def query_pager_by_slug(self, slug, current_page_num=1):
     return CabPost.select().join(CabPost2Catalog).join(CabCatalog).where(CabCatalog.slug == slug).order_by(
         CabPost.time_update.desc()).paginate(current_page_num, config.page_num)
开发者ID:Geoion,项目名称:TorCMS,代码行数:3,代码来源:mpost2catalog.py


示例16: query_random

 def query_random(self, num=6):
     if config.dbtype == 1 or config.dbtype == 3:
         return CabPost.select().order_by(peewee.fn.Random()).limit(num)
     elif config.dbtype == 2:
         return CabPost.select().order_by(peewee.fn.Rand()).limit(num)
开发者ID:daimon99,项目名称:TorCMS,代码行数:5,代码来源:mpost.py


示例17: query_old

 def query_old(self):
     return CabPost.select().order_by('time_update').limit(10)
开发者ID:daimon99,项目名称:TorCMS,代码行数:2,代码来源:mpost.py


示例18: get_by_uid

 def get_by_uid(self, sig):
     try:
         return CabPost.get(uid=sig)
     except:
         return False
开发者ID:daimon99,项目名称:TorCMS,代码行数:5,代码来源:mpost.py


示例19: get_by_keyword

 def get_by_keyword(self, par2):
     return CabPost.select().where(CabPost.title.contains(par2)).order_by(CabPost.time_update.desc()).limit(20)
开发者ID:daimon99,项目名称:TorCMS,代码行数:2,代码来源:mpost.py


示例20: query_cat_by_pager

 def query_cat_by_pager(self, cat_str, cureent):
     tt = CabPost.select().where(CabPost.id_cats.contains(str(cat_str))).order_by(
         CabPost.time_update.desc()).paginate(cureent, config.page_num)
     return tt
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:4,代码来源:mpost.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python core_tab.CabVoter2Reply类代码示例发布时间:2022-05-27
下一篇:
Python core_tab.CabMember类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap