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

Python mpost.MPost类代码示例

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

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



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

示例1: do1

def do1():
    mpost = MPost()
    recs = mpost.query_all()
    for rec in recs:
        text2 = html2text.html2text(tornado.escape.xhtml_unescape(rec.cnt_html))
        print(text2)
        writer.add_document(
            title=rec.title,
            type='<span style="color:green;">[文档]</span>',
            link='/post/{0}.html'.format(rec.uid),
            content=text2
        )
开发者ID:sunyanhui,项目名称:maplet,代码行数:12,代码来源:script_gen_whoosh_database.py


示例2: initialize

    def initialize(self):

        self.mpost = MPost()
        self.mcat = MCatalog()
        self.cats = self.mcat.query_all()
        self.mspec = SpesubModel()
        self.specs = self.mspec.get_all()
        self.mpost2catalog = MPost2Catalog()
开发者ID:Geoion,项目名称:TorCMS,代码行数:8,代码来源:cat_handler.py


示例3: render

 def render(self, num, recent, with_date=True, with_catalog=True):
     self.mpost = MPost()
     recs = self.mpost.query_recent_most(num, recent)
     kwd = {
         'with_date': with_date,
         'with_catalog': with_catalog,
     }
     return self.render_string('tplite/modules/post_list.html', recs=recs, kwd=kwd)
开发者ID:Ryan007,项目名称:TorCMS,代码行数:8,代码来源:core_modules.py


示例4: render

 def render(self, current_id):
     self.mpost = MPost()
     next_record = self.mpost.get_next_record(current_id)
     if next_record is None:
         outstr = '<a>已经是最新一篇了</a>'
     else:
         outstr = '''<a href="/post/{0}.html">下一篇</a>'''.format(next_record.uid)
     return outstr
开发者ID:vaveee,项目名称:TorCMS,代码行数:8,代码来源:modef.py


示例5: previous_post_link

class previous_post_link(tornado.web.UIModule):
    def render(self, current_id):
        self.mpost = MPost()
        prev_record = self.mpost.get_previous_record(current_id)
        if prev_record is None:
            outstr = '已经是最后一篇了'
        else:
            outstr = '''<a href="/post/{0}.html">上一篇</a>'''.format(prev_record.uid, prev_record.title)
        return outstr
开发者ID:Ryan007,项目名称:TorCMS,代码行数:9,代码来源:core_modules.py


示例6: next_post_link

class next_post_link(tornado.web.UIModule):
    def render(self, current_id):
        self.mpost = MPost()
        next_record = self.mpost.get_next_record(current_id)
        if next_record is None:
            outstr = '已经是最新一篇了'
        else:
            outstr = '''<a href="/post/{0}.html">下一篇</a>'''.format(next_record.uid)
        return outstr
开发者ID:Ryan007,项目名称:TorCMS,代码行数:9,代码来源:core_modules.py


示例7: post_cat_random

class post_cat_random(tornado.web.UIModule):
    def render(self, cat_id, num, with_date=True, with_catalog=True):
        self.mpost = MPost()
        recs = self.mpost.query_cat_random(cat_id, num)
        kwd = {
            'with_date': with_date,
            'with_catalog': with_catalog,
        }
        return self.render_string('{0}/modules/post_list.html'.format(config.torlite_template_name), recs=recs, kwd=kwd)
开发者ID:vaveee,项目名称:TorCMS,代码行数:9,代码来源:modef.py


示例8: post_most_view

class post_most_view(tornado.web.UIModule):
    def render(self, num, with_date=True, with_catalog=True):
        self.mpost = MPost()
        recs = self.mpost.query_most(num)
        kwd = {
            'with_date': with_date,
            'with_catalog': with_catalog,
        }
        return self.render_string('tplite/modules/post_list.html', recs=recs, kwd=kwd)
开发者ID:Ryan007,项目名称:TorCMS,代码行数:9,代码来源:core_modules.py


示例9: IndexHandler

class IndexHandler(tornado.web.RequestHandler):
    def initialize(self):
        self.mpost = MPost()
        self.mcat = MCatalog()

    def get(self, input=''):
        if input == '':
            self.index()
        else:
            self.render('/html/404.html')

    def index(self):
        dbdata = self.mpost.query_cat_recent(5, 16)
        recent = self.mpost.query_recent(8)
        self.render('tplite/index/index.html',
                    view=dbdata,
                    recent=recent,
                    unescape=tornado.escape.xhtml_unescape,
                    format_yr=tools.format_yr)
开发者ID:ifcheung2012,项目名称:TorCMS,代码行数:19,代码来源:index.py


示例10: build_whoosh_database

def build_whoosh_database():
    analyzer = ChineseAnalyzer()
    schema = Schema(title=TEXT(stored=True, analyzer=analyzer), type=TEXT(stored=True), link=ID(stored=True),
                    content=TEXT(stored=True, analyzer=analyzer))
    ix = create_in(whoosh_database, schema)

    writer = ix.writer()

    mpost = MPost()
    recs = mpost.query_all()
    for rec in recs:
        text2 = html2text.html2text(tornado.escape.xhtml_unescape(rec.cnt_html))
        print(text2)
        writer.add_document(
            title=rec.title,
            type='<span style="color:blue;">[文档]</span>',
            link='/post/{0}.html'.format(rec.uid),
            content=text2
        )
    writer.commit()
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:20,代码来源:script_build_whoosh_database.py


示例11: render

 def render(self, cat_id, num=10, with_catalog=True, with_date=True):
     self.mpost = MPost()
     self.mpost2cat = MPost2Catalog()
     recs = self.mpost.query_cat_recent(cat_id, num)
     kwd = {
         'with_catalog': with_catalog,
         'with_date': with_date,
     }
     return self.render_string('{0}/modules/post_list.html'.format(config.torlite_template_name),
                               recs=recs,
                               kwd=kwd, )
开发者ID:daimon99,项目名称:TorCMS,代码行数:11,代码来源:modef.py


示例12: initialize

 def initialize(self):
     self.muser = MUser()
     self.mpage = MPage()
     self.mdb = MPost()
     self.mcat = MCatalog()
     self.cats = self.mcat.query_all()
     self.mspec = SpesubModel()
     if self.get_current_user():
         self.userinfo = self.muser.get_by_id(self.get_current_user())
     else:
         self.userinfo = None
开发者ID:Ryan007,项目名称:TorCMS,代码行数:11,代码来源:spec_handler.py


示例13: initialize

 def initialize(self):
     self.init()
     self.mpost = MPost()
     self.mcat = MCatalog()
     self.cats = self.mcat.query_all()
     self.mpost_hist = MPostHist()
     self.mpost2catalog = MPost2Catalog()
     self.mpost2reply = MPost2Reply()
     self.mapp2tag = MPost2Label()
     self.mrel = MRelation()
     self.tmpl_router = 'post'
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:11,代码来源:post_handler.py


示例14: initialize

 def initialize(self):
     self.init()
     self.muser = MUser()
     self.mpost = MPost()
     self.mcat = MCatalog()
     self.cats = self.mcat.query_all()
     self.mpost2catalog = MPost2Catalog()
     if self.get_current_user():
         self.userinfo = self.muser.get_by_id(self.get_current_user())
     else:
         self.userinfo = None
开发者ID:vaveee,项目名称:TorCMS,代码行数:11,代码来源:category_handler.py


示例15: initialize

    def initialize(self):
        self.mapp = MApp()
        self.mpost = MPost()
        self.rel_post2app = MRelPost2App()
        self.rel_app2post = MRelApp2Post()
        self.muser = MUser()

        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None
            self.mvip = None
开发者ID:sunyanhui,项目名称:maplet,代码行数:12,代码来源:rel_handler.py


示例16: CategoryHandler

class CategoryHandler(BaseHandler):
    def initialize(self):
        self.init()
        self.muser = MUser()
        self.mpost = MPost()
        self.mcat = MCatalog()
        self.cats = self.mcat.query_all()
        self.mspec = SpesubModel()
        self.specs = self.mspec.get_all()
        self.mpost2catalog = MPost2Catalog()
        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None

    def get(self, input=''):
        if len(input) > 0:
            ip_arr = input.split(r'/')
        if input == '':
            pass
        elif len(ip_arr) == 1:
            self.list_catalog(input)
        elif len(ip_arr) == 2:
            self.list_catalog(ip_arr[0], ip_arr[1])
        else:
            self.render('html/404.html')

    def list_catalog(self, cat_slug, cur_p=''):
        if cur_p == '':
            current_page_num = 1
        else:
            current_page_num = int(cur_p)

        cat_rec = self.mcat.get_by_slug(cat_slug)
        num_of_cat = self.mpost2catalog.catalog_record_number(cat_rec.uid)
        page_num = int(num_of_cat / config.page_num) + 1
        cat_name = cat_rec.name
        kwd = {
            'cat_name': cat_name,
            'cat_slug': cat_slug,
            'unescape': tornado.escape.xhtml_unescape,
            'title': cat_name,
        }

        self.render('{0}/catalog/list.html'.format(self.tmpl_name),
                    infos=self.mpost2catalog.query_pager_by_slug(cat_slug, current_page_num),
                    pager=tools.gen_pager_purecss('/category/{0}'.format(cat_slug), page_num, current_page_num),
                    userinfo=self.userinfo,
                    kwd=kwd)

    def get_random(self):
        return self.mpost.query_random()
开发者ID:net4nt,项目名称:TorCMS,代码行数:52,代码来源:category_handler.py


示例17: initialize

 def initialize(self):
     self.muser = MUser()
     self.mpost = MPost()
     self.mcat = MCatalog()
     self.cats = self.mcat.query_all()
     self.mspec = SpesubModel()
     self.specs = self.mspec.get_all()
     self.mpost_hist = MPostHist()
     self.mpost2catalog = MPost2Catalog()
     if self.get_current_user():
         self.userinfo = self.muser.get_by_id(self.get_current_user())
     else:
         self.userinfo = None
开发者ID:ifcheung2012,项目名称:TorCMS,代码行数:13,代码来源:post_handler.py


示例18: render

    def render(self, uid, num, ):
        self.mpost = MPost()
        self.relation = MRelApp2Post()
        kwd = {
            'app_f': app_url_name,
            'app_t': 'post',
            'uid': uid,
        }
        rel_recs = self.relation.get_app_relations(uid, num)

        rand_recs = self.mpost.query_random(num - rel_recs.count() + 2)

        return self.render_string('app_theme/modules/relation_app2post.html',
                                  relations= rel_recs,
                                  rand_recs = rand_recs,
                                  kwd=kwd, )
开发者ID:ironhot,项目名称:maplet,代码行数:16,代码来源:extends.py


示例19: CategoryHandler

class CategoryHandler(BaseHandler):
    def initialize(self):
        self.init()
        self.mpost = MPost()
        self.mcat = MCatalog()
        self.cats = self.mcat.query_all()
        self.mpost2catalog = MPost2Catalog()


    def get(self, url_str=''):
        url_arr = self.parse_url(url_str)

        if len(url_arr) == 1:
            self.list_catalog(url_str)
        elif len(url_arr) == 2:
            self.list_catalog(url_arr[0], url_arr[1])
        else:
            self.render('html/404.html')

    def list_catalog(self, cat_slug, cur_p=''):
        if cur_p == '':
            current_page_num = 1
        else:
            current_page_num = int(cur_p)

        current_page_num = 1 if current_page_num < 1 else current_page_num
        cat_rec = self.mcat.get_by_slug(cat_slug)
        num_of_cat = self.mpost2catalog.catalog_record_number(cat_rec.uid)
        page_num = int(num_of_cat / config.page_num) + 1
        cat_name = cat_rec.name
        kwd = {
            'cat_name': cat_name,
            'cat_slug': cat_slug,
            'unescape': tornado.escape.xhtml_unescape,
            'title': cat_name,
            'current_page': current_page_num
        }

        self.render('{0}/catalog/list.html'.format(self.tmpl_name),
                    infos=self.mpost2catalog.query_pager_by_slug(cat_slug, current_page_num),
                    pager=tools.gen_pager_purecss('/category/{0}'.format(cat_slug), page_num, current_page_num),
                    userinfo=self.userinfo,
                    cfg = config.cfg,
                    kwd=kwd)

    def get_random(self):
        return self.mpost.query_random()
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:47,代码来源:category_handler.py


示例20: initialize

    def initialize(self):
        self.init()
        self.muser = MUser()
        self.mpost = MPost()
        self.mcat = MCatalog()
        self.cats = self.mcat.query_all()
        self.mpost_hist = MPostHist()
        self.mpost2catalog = MPost2Catalog()
        self.mpost2reply = MPost2Reply()
        self.mapp2tag = MPost2Label()
        self.mrel = MRelation()
        self.tmpl_router = 'post'

        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None
开发者ID:vaveee,项目名称:TorCMS,代码行数:17,代码来源:post_handler.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python mspec.SpesubModel类代码示例发布时间:2022-05-27
下一篇:
Python mcatalog.MCatalog类代码示例发布时间: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