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


Python ICriteria.values方法代码示例

本文整理汇总了Python中eea.facetednavigation.interfaces.ICriteria.values方法的典型用法代码示例。如果您正苦于以下问题:Python ICriteria.values方法的具体用法?Python ICriteria.values怎么用?Python ICriteria.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eea.facetednavigation.interfaces.ICriteria的用法示例。


在下文中一共展示了ICriteria.values方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_sorting_widget

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import values [as 别名]
def add_sorting_widget(context):
    """
    As in version 7.1 we removed default sorting by effective date, in order
    to maintain backward compatibility we will add a sorting widget, hidden
    for all faceted navigable items where this widget is not present
    """
    ctool = getToolByName(context, 'portal_catalog')
    iface = interfaceToName(context, IFacetedNavigable)
    brains = ctool.unrestrictedSearchResults(object_provides=iface)

    count = 0
    for brain in brains:
        try:
            doc = brain.getObject()
            settings = ICriteria(doc)
            sorting = [criterion for criterion in settings.values()
                       if criterion.widget == 'sorting']
            if sorting:
                continue

            settings.add(
                'sorting', 'right',
                 title='Sort on', default='effective(reverse)',
                 hidden=True
            )
        except Exception, err:
            logger.exception(err)
        else:
            logger.info('Added sorting widget for: %s', doc.absolute_url())
            count += 1
开发者ID:Martronic-SA,项目名称:eea.facetednavigation,代码行数:32,代码来源:evolve71.py

示例2: migrate_autocomplete_widget

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import values [as 别名]
def migrate_autocomplete_widget(context):
    """
    As in version 8.4 we added selection of the autocomplete suggestion
    view. To maintain backward compatibility we will set the value of
    this 'autocomplete_view' field to solr suggestions view.
    """
    ctool = getToolByName(context, 'portal_catalog')
    iface = interfaceToName(context, IFacetedNavigable)
    brains = ctool.unrestrictedSearchResults(object_provides=iface)

    count = 0
    for brain in brains:
        doc = brain.getObject()
        settings = ICriteria(doc)

        for criterion in settings.values():
            if criterion.widget == 'autocomplete':
                criterion.autocomplete_view = u'solr-autocomplete-suggest'
                logger.info(
                    'Set defaut autocomplete view of widget: %s',
                    criterion.title
                )
                count += 1

    logger.info('Migrated %s autocomplete widgets', count)
开发者ID:Martronic-SA,项目名称:eea.facetednavigation,代码行数:27,代码来源:evolve84.py

示例3: language_present

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import values [as 别名]
    def language_present(self):
        """ Is there any widget for Language index?
        """

        criteria = ICriteria(self.context)
        for criterion in criteria.values():
            if criterion.get('index', None) == 'Language':
                if not criterion.hidden:
                    return True
        return False
开发者ID:Martronic-SA,项目名称:eea.facetednavigation,代码行数:12,代码来源:view.py

示例4: get_widgets

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import values [as 别名]
 def get_widgets(self, position='', section=''):
     """ Get all widgets
     """
     criteria = ICriteria(self.context)
     for criterion in criteria.values():
         if position and criterion.get('position', 'right') != position:
             continue
         if section and criterion.get('section', 'default') != section:
             continue
         widget = criteria.widget(wid=criterion.get('widget'))
         yield widget(self.context, self.request, criterion)
开发者ID:Martronic-SA,项目名称:eea.facetednavigation,代码行数:13,代码来源:view.py

示例5: get_widgets

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import values [as 别名]
 def get_widgets(self, position="", section=""):
     """ Get all widgets
     """
     criteria = ICriteria(self.context)
     for criterion in criteria.values():
         if position and criterion.get("position", "right") != position:
             continue
         if section and criterion.get("section", "default") != section:
             continue
         widget = criteria.widget(wid=criterion.get("widget"))
         yield widget(self.context, self.request, criterion)
开发者ID:david-batranu,项目名称:eea.facetednavigation,代码行数:13,代码来源:view.py

示例6: DatasetsCollectionListView

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import values [as 别名]
class DatasetsCollectionListView(BrowserView):

    title = u"Collections"

    def __init__(self, context, request):
        # TODO: update this to new workings of collection facet (now that we have a custom portal_type)
        super(DatasetsCollectionListView, self).__init__(context, request)
        self.datasets_url = self.context.absolute_url()
        self.criteria = ICriteria(self.context, {})
        self.defaults = {}
        self.criterion = None
        for criterion in self.criteria.values():
            if criterion.widget == 'pathselect':
                self.criterion = criterion
            if criterion.widget == 'sorting':
                default = criterion.default
                if not default:
                    continue
                if '(reverse)' in default:
                    default = default.replace('(reverse)', '', 1)
                    self.defaults['reversed'] = True
                self.defaults[criterion.getId()] = default

    def categories(self):
        for term in getUtility(IVocabularyFactory, 'collection_category_source')(self.context):
            yield term

    def get_browse_link(self, uuid):
        # return link into datasets facetedview to filter given collection
        collection = uuidToCatalogBrain(uuid)
        if not collection:
            return self.datasets_url
        params = dict(self.defaults)
        if self.criterion:
            params[self.criterion.getId()] = collection.UID
            return "{}#{}".format(self.datasets_url, urlencode(params))
        # fallback to original datasets_listing_view
        groupid = collection.getObject().__parent__.getId()
        params['datasets.filter.source:list'] = '{}-{}'.format(self.datesets_url, groupid, collection.getId)
        return "{}/?{}" . format(self.datasets_url, urlencode(params))
开发者ID:BCCVL,项目名称:org.bccvl.site,代码行数:42,代码来源:datasets_collection_list.py


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