本文整理汇总了Python中MaKaC.conference.CategoryManager.getTitle方法的典型用法代码示例。如果您正苦于以下问题:Python CategoryManager.getTitle方法的具体用法?Python CategoryManager.getTitle怎么用?Python CategoryManager.getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.conference.CategoryManager
的用法示例。
在下文中一共展示了CategoryManager.getTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _getAnswer
# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getTitle [as 别名]
def _getAnswer(self):
import MaKaC.common.indexes as indexes
nameIdx = indexes.IndexesHolder().getIndex('categoryName')
try:
query = ' AND '.join(map(lambda y: "*%s*" % y, filter(lambda x: len(x) > 0, self._searchString.split(' '))))
foundEntries = nameIdx.search(query)
except parsetree.ParseError:
foundEntries = []
number = len(foundEntries)
# get only the first 10 results
foundEntries = foundEntries[:7]
entryNames = []
for (categId, value) in foundEntries:
categ = CategoryManager().getById(categId)
entryNames.append({
'title': categ.getTitle(),
'path': self._getPath(categ),
'url': str(urlHandlers.UHCategoryDisplay.getURL(categ))
})
return {
"list": entryNames,
"number": number
}
示例2: _getAnswer
# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getTitle [as 别名]
def _getAnswer(self):
import MaKaC.common.indexes as indexes
nameIdx = indexes.IndexesHolder().getIndex('conferenceTitle')
query = ' '.join(map(lambda y: "*%s*" % y, self._searchString.split()))
foundEntries = nameIdx.search(query)
number = len(foundEntries)
# get only the first 10 results
foundEntries = foundEntries[:7]
entryTitles = []
for (confId, value) in foundEntries:
conference = CategoryManager().getById(confId)
entryTitles.append({
'title': conference.getTitle(),
'url': str(urlHandlers.UHConferenceDisplay.getURL(conference))
})
return {
"list": entryTitles,
"number": number
}
示例3: _process
# 需要导入模块: from MaKaC.conference import CategoryManager [as 别名]
# 或者: from MaKaC.conference.CategoryManager import getTitle [as 别名]
def _process(self):
matches = IndexesHolder().getIndex('categoryName').search(request.args['term'])
results = []
for category_id in matches[:7]:
try:
categ = CategoryManager().getById(category_id)
except KeyError:
continue
results.append({
'title': to_unicode(categ.getTitle()),
'path': map(to_unicode, categ.getCategoryPathTitles()[1:-1]),
'url': unicode(UHCategoryDisplay.getURL(categ))
})
return jsonify(success=True, results=results, count=len(matches))