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


Python ICriteria.add方法代码示例

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


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

示例1: add_sorting_widget

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import add [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: add

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import add [as 别名]
    def add(self, **kwargs):
        """ See IFacetedCriterionHandler
        """
        kwargs = self._request_form(kwargs)

        wid = kwargs.pop('wtype', None)
        position = kwargs.pop('wposition', 'right')
        section = kwargs.pop('wsection', 'default')

        criteria = ICriteria(self.context)
        cid = criteria.add(wid, position, section)
        return self.edit(cid, **kwargs)
开发者ID:Conectivo,项目名称:eea.facetednavigation,代码行数:14,代码来源:configure.py

示例3: add

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import add [as 别名]
    def add(self, **kwargs):
        """ See IFacetedCriterionHandler
        """
        wid = kwargs.pop('wtype',
                         self.request.get('wtype', None))
        position = kwargs.pop('wposition',
                              self.request.get('wposition', 'right'))
        section = kwargs.pop('wsection',
                             self.request.get('wsection', 'default'))

        criteria = ICriteria(self.context)
        cid = criteria.add(wid, position, section)
        return self.edit(cid, __new__=True, **kwargs)
开发者ID:Martronic-SA,项目名称:eea.facetednavigation,代码行数:15,代码来源:configure.py

示例4: installFacetedNavigation

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import add [as 别名]
def installFacetedNavigation(obj, event):
    if not ISecretomeFolder.providedBy(obj): return
    factory = getToolByName(obj, 'portal_factory')
    if factory.isTemporary(obj): return
    request = obj.REQUEST
    subtyper = getMultiAdapter((obj, request), name=u'faceted_subtyper')
    if subtyper.is_faceted or not subtyper.can_enable: return
    subtyper.enable()
    criteria = ICriteria(obj)
    for cid in criteria.keys():
        criteria.delete(cid)
    criteria.add('resultsperpage', 'bottom', 'default', title='Results per page', hidden=True, start=0, end=50, step=5,
        default=20)
    criteria.add(
        'checkbox', 'bottom', 'default',
        title='Obj provides',
        hidden=True,
        index='object_provides',
        operator='or',
        vocabulary=u'eea.faceted.vocabularies.ObjectProvides',
        default=[IGeneProtein.__identifier__],
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add('debug', 'top', 'default', title='Debug Criteria', user='kelly')
    criteria.add(
        'checkbox', 'left', 'default',
        title=u'Databases',
        hidden=False,
        index='databaseNames',
        operator='or',
        vocabulary=u'eke.secretome.DatabaseNamesVocabulary',
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    IFacetedLayout(obj).update_layout(u'faceted_secretome_view')
    noLongerProvides(obj, IHidePloneLeftColumn)
开发者ID:EDRN,项目名称:eke.secretome,代码行数:43,代码来源:secretomefolder.py

示例5: createMembersListSearchPage

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import add [as 别名]
def createMembersListSearchPage(portal):
    '''Create the members list page'''
    # New in profile version 1 (software version 1.0.2):
    request = portal.REQUEST
    if 'members-list' in portal.objectIds():
        portal.manage_delObjects('members-list')
    membersList = portal[portal.invokeFactory('Folder', 'members-list')]
    membersList.setTitle('Members List')
    membersList.setDescription('A directory of the people that comprise EDRN.')
    membersList.setExcludeFromNav(True)
    _doPublish(membersList, getToolByName(portal, 'portal_workflow'))
    subtyper = getMultiAdapter((membersList, request), name=u'faceted_subtyper')
    subtyper.enable()
    layout = IFacetedLayout(membersList)
    layout.update_layout('folder_listing')
    criteria = ICriteria(membersList)
    for cid in criteria.keys():
        criteria.delete(cid)
    criteria.add('resultsperpage', 'bottom', 'default', title='Results per page', hidden=True, start=0, end=50, step=5, default=20)
    criteria.add('sorting', 'bottom', 'default', title='Sort on', hidden=True, default='sortable_title')
    criteria.add(
        'checkbox', 'bottom', 'default',
        title='Obj provides',
        hidden=True,
        index='object_provides',
        operator='or',
        vocabulary=u'eea.faceted.vocabularies.ObjectProvides',
        default=[IPerson.__identifier__],
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Investigator',
        hidden=False,
        index='piUID',
        operator='or',
        vocabulary=u'eke.site.PrincipalInvestigators',
        count=False,
        maxitems=4,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Type',
        index='investigatorStatus',
        operator='or',
        vocabulary=u'eke.site.NotPeons',
        count=True,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Institution',
        hidden=False,
        index='siteName',
        operator='or',
        vocabulary=u'eke.site.SitesNames',
        count=True,
        maxitems=4,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Member Type',
        hidden=False,
        index='memberType',
        operator='or',
        vocabulary=u'eke.site.MemberType',
        count=True,
        maxitems=20,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add('criteria', 'top', 'default', title='Current Search')
    membersList.reindexObject()
开发者ID:EDRN,项目名称:edrnsite.policy,代码行数:84,代码来源:setuphandlers.py

示例6: setFacetedNavigation

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import add [as 别名]
def setFacetedNavigation(folder, request):
    subtyper = getMultiAdapter((folder, request), name=u'faceted_subtyper')
    if subtyper.is_faceted or not subtyper.can_enable: return
    subtyper.enable()
    urlTool = getToolByName(folder, 'portal_url')
    path = '/' + '/'.join(urlTool.getRelativeContentPath(folder))
    criteria = ICriteria(folder)
    for cid in criteria.keys():
        criteria.delete(cid)
    criteria.add('resultsperpage', 'bottom', 'default', title='Results per page', hidden=True, start=0, end=50, step=5, default=20)
    criteria.add('sorting', 'bottom', 'default', title='Sort on', hidden=True, default='sortable_title')
    criteria.add(
        'checkbox', 'left', 'default',
        title='System',
        hidden=False,
        index='getSystemName',
        operator='or',
        vocabulary=u'eke.specimens.vocab.SystemNames',
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Diagnosis',
        hidden=False,
        index='diagnosis',
        operator='or',
        vocabulary=u'eke.specimens.vocab.Diagnoses',
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Storage',
        hidden=False,
        index='getStorageType',
        operator='or',
        vocabulary=STORAGE_VOCAB_NAME,
        count=False,
        maxitems=5,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Collection Type',
        hidden=False,
        index='collectionType',
        operator='or',
        vocabulary=COLLECTION_VOCAB_NAME,
        count=False,
        maxitems=5,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Site',
        hidden=False,
        index='siteName',
        operator='or',
        vocabulary=u'eke.specimens.vocab.SitesWithSpecimens',
        count=False,
        maxitems=5,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'bottom', 'default',
        title='Obj provides',
        hidden=True,
        index='object_provides',
        operator='or',
        vocabulary=u'eea.faceted.vocabularies.ObjectProvides',
        default=[ISpecimenSet.__identifier__],
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'text', 'center', 'default',
        title='Open Search',
        hidden=False,
        index='SearchableText',
    )
    criteria.add('path', 'bottom', 'default', title='Path Search', hidden=True, index='path', default=path)
    IFacetedLayout(folder).update_layout('faceted_specimens_view')
    alsoProvides(folder, IHidePloneRightColumn)
开发者ID:EDRN,项目名称:eke.specimens,代码行数:95,代码来源:utils.py

示例7: setFacetedNavigation

# 需要导入模块: from eea.facetednavigation.interfaces import ICriteria [as 别名]
# 或者: from eea.facetednavigation.interfaces.ICriteria import add [as 别名]
def setFacetedNavigation(folder, request, force=False):
    subtyper = getMultiAdapter((folder, request), name=u'faceted_subtyper')
    if (subtyper.is_faceted or not subtyper.can_enable) and not force: return
    subtyper.enable()
    urlTool = plone.api.portal.get_tool(name='portal_url')
    path = '/' + '/'.join(urlTool.getRelativeContentPath(folder))
    criteria = ICriteria(folder)
    for cid in criteria.keys():
        criteria.delete(cid)
    criteria.add(
        'checkbox', 'left', 'default',
        title=u'Organ',
        hidden=False,
        index='indicatedBodySystems',
        operator='or',
        vocabulary=u'eke.biomarker.IndicatedOrgansVocabulary',
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add('resultsperpage', 'bottom', 'default', title='Results per page', hidden=True, start=0, end=50, step=5, default=20)
    criteria.add('sorting', 'bottom', 'default', title='Sort on', hidden=True, default='sortable_title')
    criteria.add(
        'checkbox', 'bottom', 'default',
        title='Obj provides',
        hidden=True,
        index='object_provides',
        operator='or',
        vocabulary=u'eea.faceted.vocabularies.ObjectProvides',
        default=[IBiomarker.__identifier__],
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add('path', 'bottom', 'default', title='Path Search', hidden=True, index='path', default=path)
    criteria.add('text', 'top', 'default', title=u'Search', hidden=False, index='SearchableText', count=False,
        onlyallelements=True)
    IFacetedLayout(folder).update_layout('faceted_biomarkers_view')
    noLongerProvides(folder, IHidePloneLeftColumn)
    noLongerProvides(folder, IHidePloneRightColumn)
开发者ID:EDRN,项目名称:eke.biomarker,代码行数:44,代码来源:utils.py


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