当前位置: 首页>>代码示例>>Python>>正文


Python CategoryManager.getTitle方法代码示例

本文整理汇总了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
            }
开发者ID:aninhalacerda,项目名称:indico,代码行数:32,代码来源:search.py

示例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
            }
开发者ID:Json-Andriopoulos,项目名称:indico,代码行数:28,代码来源:search.py

示例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))
开发者ID:florv,项目名称:indico-plugins,代码行数:17,代码来源:controllers.py


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