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


Python CabPost.update方法代码示例

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


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

示例1: update

# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import update [as 别名]
    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,代码行数:27,代码来源:mpost.py

示例2: update_view_count_by_uid

# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import update [as 别名]
 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,代码行数:9,代码来源:mpost.py

示例3: update

# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import update [as 别名]
    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,代码行数:39,代码来源:mpost.py

示例4: update_keywords

# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import update [as 别名]
 def update_keywords(self, uid, inkeywords):
     entry = CabPost.update(keywords=inkeywords).where(CabPost.uid == uid)
     entry.execute()
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:5,代码来源:mpost.py

示例5: update_view_count_by_uid

# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import update [as 别名]
 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,代码行数:5,代码来源:mpost.py

示例6: update_view_count

# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import update [as 别名]
 def update_view_count(self, citiao):
     entry = CabPost.update(view_count=CabPost.view_count + 1).where(CabPost.title == citiao)
     entry.execute()
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:5,代码来源:mpost.py


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