本文整理汇总了Python中MaKaC.conference.CategoryManager.isRoot方法的典型用法代码示例。如果您正苦于以下问题:Python CategoryManager.isRoot方法的具体用法?Python CategoryManager.isRoot怎么用?Python CategoryManager.isRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.conference.CategoryManager
的用法示例。
在下文中一共展示了CategoryManager.isRoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RHSearch
# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import isRoot [as 别名]
class RHSearch(RHCustomizable):
"""Performs a search using the search engine plugin"""
def _checkParams(self):
if 'confId' in request.view_args:
self.obj = self._conf = ConferenceHolder().getById(request.view_args['confId'])
self.obj_type = 'event'
elif 'categId' in request.view_args:
self.obj = CategoryManager().getById(request.view_args['categId'])
self.obj_type = 'category' if not self.obj.isRoot() else None
else:
self.obj = CategoryManager().getRoot()
self.obj_type = None
def _process(self):
with current_plugin.engine_plugin.plugin_context():
form = current_plugin.search_form(prefix='search-', csrf_enabled=False)
result = None
if form.validate_on_submit():
result = current_plugin.perform_search(form.data, self.obj)
if isinstance(result, Response): # probably a redirect or a json response
return result
view_class = WPSearchConference if isinstance(self.obj, Conference) else WPSearchCategory
return view_class.render_template('results.html', self.obj, only_public=current_plugin.only_public,
form=form, obj_type=self.obj_type, result=result)