本文整理汇总了Python中model.Category.get_all_cat_name方法的典型用法代码示例。如果您正苦于以下问题:Python Category.get_all_cat_name方法的具体用法?Python Category.get_all_cat_name怎么用?Python Category.get_all_cat_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Category
的用法示例。
在下文中一共展示了Category.get_all_cat_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from model import Category [as 别名]
# 或者: from model.Category import get_all_cat_name [as 别名]
def get(self, name = ''):
objs = Tag.get_tag_page_posts(name, 1)
catobj = Tag.get_tag_by_name(name)
if catobj:
pass
else:
self.redirect(BASE_URL)
return
allpost = catobj.id_num
allpage = allpost/EACH_PAGE_POST_NUM
if allpost%EACH_PAGE_POST_NUM:
allpage += 1
output = self.render('index.html', {
'title': "%s - %s"%( catobj.name, SITE_TITLE),
'keywords':catobj.name,
'description':SITE_DECR,
'objs': objs,
'cats': Category.get_all_cat_name(),
'tags': Tag.get_hot_tag_name(),
'page': 1,
'allpage': allpage,
'listtype': 'tag',
'name': name,
'namemd5': md5(name.encode('utf-8')).hexdigest(),
'comments': Comment.get_recent_comments(),
'links':Link.get_all_links(),
},layout='_layout.html')
self.write(output)
return output
示例2: get
# 需要导入模块: from model import Category [as 别名]
# 或者: from model.Category import get_all_cat_name [as 别名]
def get(self, name = ''):
objs = Category.get_cat_page_posts(name, 1)
catobj = Category.get_cat_by_name(name)
if catobj:
pass
else:
self.redirect(BASE_URL)
return
allpost = catobj.id_num
allpage = allpost/EACH_PAGE_POST_NUM
if allpost%EACH_PAGE_POST_NUM:
allpage += 1
output = self.render('index.html', {
'title': "%s - %s"%( catobj.name, getAttr('SITE_TITLE')),
'keywords':catobj.name,
'description':getAttr('SITE_DECR'),
'objs': objs,
'cats': Category.get_all_cat_name(),
'tags': Tag.get_hot_tag_name(),
'archives': Archive.get_all_archive_name(),
'page': 1,
'allpage': allpage,
'listtype': 'cat',
'name': name,
'namemd5': md5(name.encode('utf-8')).hexdigest(),
'comments': Comment.get_recent_comments(),
'links':Link.get_all_links(),
'isauthor':self.isAuthor(),
'Totalblog':get_count('Totalblog',NUM_SHARDS,0),
},layout='_layout.html')
self.write(output)
return output
示例3: get
# 需要导入模块: from model import Category [as 别名]
# 或者: from model.Category import get_all_cat_name [as 别名]
def get(self, id=""):
obj = None
if id:
obj = Article.get_article_by_id_edit(id)
self.echo(
"admin_editpost.html",
{"title": "编辑文章", "cats": Category.get_all_cat_name(), "tags": Tag.get_all_tag_name(), "obj": obj},
layout="_layout_admin.html",
)
示例4: get
# 需要导入模块: from model import Category [as 别名]
# 或者: from model.Category import get_all_cat_name [as 别名]
def get(self, id = ''):
obj = None
if id:
obj = Article.get_article_by_id_edit(id)
self.echo('admin_editpost.html', {
'title': "编辑文章",
'cats': Category.get_all_cat_name(),
'tags': Tag.get_all_tag_name(),
'obj': obj
},layout='_layout_admin.html')
示例5: wx_get_categories
# 需要导入模块: from model import Category [as 别名]
# 或者: from model.Category import get_all_cat_name [as 别名]
def wx_get_categories(self):
k = 'wx_cats'
v = getMc(k)
if v:
return v
cat_list = Category.get_all_cat_name()
catstr = "分类列表如下,回复c+数字,即可获取该分类文章:\n"
if MYSQL_TO_KVDB_SUPPORT:
mylist = ["%d %s" % (loop,(cat[0]).encode('utf-8')) for loop,cat in enumerate(sorted(cat_list))]
else:
mylist = ["%d %s" % (int(cat.id),(cat.name).encode('utf-8')) for cat in cat_list]
mylist.reverse()
catstr += "\n".join(mylist)
setMc(k,catstr)
return catstr
示例6: get
# 需要导入模块: from model import Category [as 别名]
# 或者: from model.Category import get_all_cat_name [as 别名]
def get(self, listtype = '', direction = 'next', page = '1', name = ''):
if listtype == 'cat':
objs = Category.get_cat_page_posts(name, page)
catobj = Category.get_cat_by_name(name)
elif listtype == 'tag':
objs = Tag.get_tag_page_posts(name, page)
catobj = Tag.get_tag_by_name(name)
elif listtype == 'archive':
objs = Archive.get_archive_page_posts(name, page)
catobj = Archive.get_archive_by_name(name)
#
if not catobj:
return self.redirect(BASE_URL)
if not objs:
return self.redirect(BASE_URL)
if MYSQL_TO_KVDB_SUPPORT:
allpost = len(catobj.split(','))
else:
allpost = catobj.id_num
allpage = allpost/EACH_PAGE_POST_NUM
if allpost%EACH_PAGE_POST_NUM:
allpage += 1
output = self.render('index.html', {
'title': "%s - %s | Part %s"%( name, getAttr('SITE_TITLE'), page),
'keywords':name,
'description':getAttr('SITE_DECR'),
'objs': objs,
'cats': Category.get_all_cat_name(),
'tags': Tag.get_hot_tag_name(),
'archives': Archive.get_all_archive_name(),
'page': int(page),
'allpage': allpage,
'listtype': listtype,
'name': name,
'namemd5': md5(name.encode('utf-8')).hexdigest(),
'comments': Comment.get_recent_comments(),
'links':Link.get_all_links(),
'isauthor':self.isAuthor(),
'Totalblog':get_count('Totalblog',NUM_SHARDS,0),
},layout='_layout.html')
self.write(output)
return output