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


Python core_tab.CabVoter2Reply类代码示例

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


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

示例1: get_by_wiki

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

示例2: query_random

 def query_random(self, num=6):
     if config.dbtype == 1 or config.dbtype == 3:
         return CabVoter2Reply.select().order_by(
             peewee.fn.Random()).limit(num)
     elif config.dbtype == 2:
         return CabVoter2Reply.select().order_by(
             peewee.fn.Rand()).limit(num)
开发者ID:daimon99,项目名称:TorCMS,代码行数:7,代码来源:mreply2user.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 CabVoter2Reply.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
             peewee.fn.Random()).limit(num)
     elif config.dbtype == 2:
         return CabVoter2Reply.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
             peewee.fn.Rand()).limit(num)
开发者ID:Ryan007,项目名称:TorCMS,代码行数:9,代码来源:mreply2user.py

示例4: get_previous_record

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

示例5: insert_data

    def insert_data(self, user_id, reply_id):

        record = CabVoter2Reply.select().where(
            (CabVoter2Reply.reply_id == reply_id) & ( CabVoter2Reply.voter_id == user_id ))

        if record.count() > 0:
            pass
            return (False)
        else:
            entry = CabVoter2Reply.create(
                uid=tools.get_uuid(),
                reply_id=reply_id,
                voter_id=user_id,
                timestamp=time.time(),
            )
            cur_count = CabVoter2Reply.select().where(CabVoter2Reply.reply_id == reply_id).count()

            return cur_count
开发者ID:Ryan007,项目名称:TorCMS,代码行数:18,代码来源:mreply2user.py

示例6: insert_data

    def insert_data(self, user_id, reply_id):

        record = CabVoter2Reply.select().where(
            (CabVoter2Reply.reply_id == reply_id) & (CabVoter2Reply.voter_id == user_id))

        if record.count() > 0:
            return (False)

        try:
            CabVoter2Reply.create(
                uid=tools.get_uuid(),
                reply_id=reply_id,
                voter_id=user_id,
                timestamp=time.time(),
            )
            return CabVoter2Reply.select().where(CabVoter2Reply.reply_id == reply_id).count()

        except:
            return False
开发者ID:daimon99,项目名称:TorCMS,代码行数:19,代码来源:mreply2user.py

示例7: delete

    def delete(self, del_id):

        try:
            del_count = CabReply.delete().where(CabReply.uid == del_id)
            del_count.execute()

            del_count2 = CabVoter2Reply.delete().where(CabVoter2Reply.reply_id == del_id)
            del_count2.execute()
            return True
        except:
            return False
开发者ID:Ryan007,项目名称:TorCMS,代码行数:11,代码来源:mreply2user.py

示例8: 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 = CabVoter2Reply.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(
                    CabVoter2Reply.uid == uid)
        else:
            entry = CabVoter2Reply.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(
                    CabVoter2Reply.uid == uid)
        entry.execute()
开发者ID:daimon99,项目名称:TorCMS,代码行数:39,代码来源:mreply2user.py

示例9: query_by_spec

 def query_by_spec(self, spec_id):
     tt = CabVoter2Reply.select().where(
         CabVoter2Reply.id_spec == spec_id).order_by(
             CabVoter2Reply.time_update.desc())
     return tt
开发者ID:daimon99,项目名称:TorCMS,代码行数:5,代码来源:mreply2user.py

示例10: update_keywords

 def update_keywords(self, uid, inkeywords):
     entry = CabVoter2Reply.update(keywords=inkeywords).where(
         CabVoter2Reply.uid == uid)
     entry.execute()
开发者ID:daimon99,项目名称:TorCMS,代码行数:4,代码来源:mreply2user.py

示例11: __init__

 def __init__(self):
     try:
         CabVoter2Reply.create_table()
     except:
         pass
开发者ID:daimon99,项目名称:TorCMS,代码行数:5,代码来源:mreply2user.py

示例12: update_view_count

 def update_view_count(self, citiao):
     entry = CabVoter2Reply.update(
         view_count=CabVoter2Reply.view_count + 1).where(
             CabVoter2Reply.title == citiao)
     entry.execute()
开发者ID:daimon99,项目名称:TorCMS,代码行数:5,代码来源:mreply2user.py

示例13: update_view_count_by_uid

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

示例14: get_by_id

 def get_by_id(self, in_uid):
     recs = CabVoter2Reply.select().where(
         CabVoter2Reply.reply_id == in_uid).order_by(
             CabVoter2Reply.timestamp.desc())
     return recs
开发者ID:daimon99,项目名称:TorCMS,代码行数:5,代码来源:mreply2user.py

示例15: query_cat_by_pager

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


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