本文整理汇总了Python中torlite.model.mcatalog.MCatalog类的典型用法代码示例。如果您正苦于以下问题:Python MCatalog类的具体用法?Python MCatalog怎么用?Python MCatalog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MCatalog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: PageAjaxHandler
class PageAjaxHandler(PageHandler):
def initialize(self):
self.init()
self.mpage = MPage()
self.mcat = MCatalog()
self.cats = self.mcat.query_all()
self.tmpl_router = 'page_ajax'
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:7,代码来源:page_handler.py
示例3: initialize
def initialize(self):
self.mdb = MPage()
self.mcat = MCatalog()
self.cats = self.mcat.query_all()
self.mspec = SpesubModel()
self.specs = self.mspec.get_all()
开发者ID:ifcheung2012,项目名称:TorCMS,代码行数:7,代码来源:page_handler.py
示例4: IndexHandler
class IndexHandler(tornado.web.RequestHandler):
def initialize(self):
self.mpost = MPost()
self.mcat = MCatalog()
self.muser = MUser()
if self.get_current_user():
self.userinfo = self.muser.get_by_id(self.get_current_user())
else:
self.userinfo = None
def get_current_user(self):
return self.get_secure_cookie("user")
def get(self, input=''):
if input == '':
self.index()
else:
self.render('html/404.html')
def index(self):
cstr = tools.get_uuid()
self.set_cookie('user_pass', cstr)
kwd = {
'cookie_str': cstr
}
self.render('tplite/index/index.html',
kwd = kwd,
userinfo=self.userinfo,
catalog_info = self.mcat.query_all( by_order=True)
)
开发者ID:Ryan007,项目名称:TorCMS,代码行数:30,代码来源:index.py
示例5: initialize
def initialize(self):
self.init()
self.mpost = MPost()
self.mcat = MCatalog()
self.cats = self.mcat.query_all()
self.mpost2catalog = MPost2Catalog()
self.ysearch = yunsearch()
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:7,代码来源:search_handler.py
示例6: render
def render(self):
self.mcat = MCatalog()
all_cats = self.mcat.query_all()
kwd = {
'cats': all_cats,
}
return self.render_string('tplite/modules/menu.html', kwd=kwd)
开发者ID:Ryan007,项目名称:TorCMS,代码行数:7,代码来源:core_modules.py
示例7: AppIndexHandler
class AppIndexHandler(BaseHandler):
def initialize(self):
self.mpost = MPost()
self.mcat = MCatalog()
self.muser = MUser()
if self.get_current_user():
self.userinfo = self.muser.get_by_id(self.get_current_user())
else:
self.userinfo = None
self.tmpl_sig = app_template_name
def get(self, input=''):
if input == '':
self.index()
else:
self.render('html/404.html')
def index(self):
cstr = tools.get_uuid()
self.set_cookie('user_pass', cstr)
kwd = {
'cookie_str': cstr
}
self.render('{0}/index/index.html'.format(self.tmpl_sig),
kwd=kwd,
userinfo=self.userinfo,
catalog_info=self.mcat.query_all(by_order=True)
)
开发者ID:shiweihappy,项目名称:maplet,代码行数:28,代码来源:index_app.py
示例8: render
def render(self, *args, **kwargs):
self.mpost2catalog = MPost2Catalog()
self.mcat = MCatalog()
cat_slug = args[0]
current = int(args[1])
# cat_slug 分类
# current 当前页面
cat_rec = self.mcat.get_by_slug(cat_slug)
num_of_cat = self.mpost2catalog.catalog_record_number(cat_rec.uid)
tmp_page_num = int(num_of_cat / config.page_num)
page_num = tmp_page_num if abs(tmp_page_num - num_of_cat / config.page_num) < 0.1 else tmp_page_num + 1
kwd = {
'page_home': False if current <= 1 else True,
'page_end': False if current >= page_num else True,
'page_pre': False if current <= 1 else True,
'page_next': False if current >= page_num else True,
}
return self.render_string('{0}/modules/catalog_pager.html'.format(config.torlite_template_name),
kwd = kwd,
cat_slug = cat_slug,
pager_num = page_num,
page_current = current,
)
开发者ID:iicc,项目名称:TorCMS,代码行数:30,代码来源:modef.py
示例9: IndexHandler
class IndexHandler(BaseHandler):
def initialize(self):
self.mpost = MPost()
self.mcat = MCatalog()
self.muser = MUser()
self.mpage = MPage()
self.mlink = MLink()
if self.get_current_user():
self.userinfo = self.muser.get_by_id(self.get_current_user())
else:
self.userinfo = None
def get_current_user(self):
return self.get_secure_cookie("user")
def get(self, input=''):
if input == '':
self.index()
else:
self.render('html/404.html')
def index(self):
cstr = tools.get_uuid()
self.set_cookie('user_pass', cstr)
kwd = {
'cookie_str': cstr
}
self.render('index/index.html',
userinfo=self.userinfo,
catalog_info=self.mcat.query_all(by_order=True),
link= self.mlink.query_all(),
unescape=tornado.escape.xhtml_unescape,
cfg = config.cfg,
kwd=kwd,)
开发者ID:vaveee,项目名称:TorCMS,代码行数:34,代码来源:index.py
示例10: initialize
def initialize(self):
self.init()
self.muser = MUser()
self.mwiki = MWiki()
self.mcat = MCatalog()
self.cats = self.mcat.query_all()
self.mwiki_hist = MWikiHist()
开发者ID:vaveee,项目名称:TorCMS,代码行数:7,代码来源:wiki_handler.py
示例11: 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
示例12: get_footer
class get_footer(tornado.web.UIModule):
def render(self):
self.mcat = MCatalog()
all_cats = self.mcat.query_all()
kwd = {
'cats': all_cats,
}
return self.render_string('tplite/modules/menu.html', kwd=kwd)
开发者ID:Ryan007,项目名称:TorCMS,代码行数:8,代码来源:core_modules.py
示例13: 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
示例14: render
def render(self):
self.mcat = MCatalog()
all_cats = self.mcat.query_all()
kwd = {
'cats': all_cats,
}
return self.render_string('{0}/modules/menu.html'.format(config.torlite_template_name),
kwd=kwd)
开发者ID:vaveee,项目名称:TorCMS,代码行数:8,代码来源:modef.py
示例15: render
def render(self, with_count=True):
self.mcat = MCatalog()
all_cats = self.mcat.query_all(with_count=True)
kwd = {
'cats': all_cats,
'with_count': with_count,
}
return self.render_string('tplite/modules/menu_post.html', kwd=kwd)
开发者ID:Geoion,项目名称:TorCMS,代码行数:8,代码来源:menu.py
示例16: initialize
def initialize(self):
self.mpost = MPost()
self.mcat = MCatalog()
self.muser = MUser()
if self.get_current_user():
self.userinfo = self.muser.get_by_id(self.get_current_user())
else:
self.userinfo = None
开发者ID:Ryan007,项目名称:TorCMS,代码行数:8,代码来源:index.py
示例17: initialize
def initialize(self):
self.mpost = MPost()
self.mcat = MCatalog()
self.muser = MUser()
if self.get_current_user():
self.userinfo = self.muser.get_by_id(self.get_current_user())
else:
self.userinfo = None
self.tmpl_sig = app_template_name
开发者ID:shiweihappy,项目名称:maplet,代码行数:9,代码来源:index_app.py
示例18: initialize
def initialize(self):
self.init()
self.muser = MUser()
self.mclass = MCatalog()
self.tmpl_router = 'maintain_category'
if self.get_current_user():
self.userinfo = self.muser.get_by_id(self.get_current_user())
else:
self.userinfo = None
开发者ID:vaveee,项目名称:TorCMS,代码行数:9,代码来源:maintain_handler.py
示例19: 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
示例20: 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
注:本文中的torlite.model.mcatalog.MCatalog类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论