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


Python IContentish.providedBy方法代码示例

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


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

示例1: list_content

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
def list_content(content, callback):
    """Recursively list CMF content out of the given one. ``callback``
    is called every thousand items after a commit.
    """

    def recurse(content):
        for child in content.contentValues():
            if IFolderish.providedBy(child):
                for grandchild in recurse(child):
                    yield grandchild
            yield child

    count = 0
    total = 0
    if IFolderish.providedBy(content):
        for child in recurse(content):
            yield child
            count += 1
            total += 1
            if count > 200:
                logger.info('{0} items indexed'.format(total))
                transaction.commit()
                content._p_jar.cacheGC()
                callback()
                count = 0
        yield content
    elif IContentish.providedBy(content):
        yield content
开发者ID:infrae,项目名称:collective.elasticindex,代码行数:30,代码来源:changes.py

示例2: publishTraverse

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
    def publishTraverse(self, request, name):
        # Try to get an object using default traversal
        adapter = DefaultPublishTraverse(self.context, request)
        try:
            obj = adapter.publishTraverse(request, name)
            if (not IContentish.providedBy(obj)
                    and not IService.providedBy(obj)):
                raise KeyError

        # If there's no object with the given name, we get a KeyError.
        # In a non-folderish context a key lookup results in an AttributeError.
        except (KeyError, AttributeError):
            # No object, maybe a named rest service
            service = queryMultiAdapter((self.context, request),
                                        name=request._rest_service_id + name)
            if service is None:
                # No service, fallback to regular view
                view = queryMultiAdapter((self.context, request), name=name)
                if view is not None:
                    return view
                raise
            return service
        else:
            # Wrap object to ensure we handle further traversal
            return RESTWrapper(obj, request)
开发者ID:plone,项目名称:plone.rest,代码行数:27,代码来源:traverse.py

示例3: getLanguage

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
    def getLanguage(self, langs, env):

        if not IFtwSubsiteLayer.providedBy(env):
            return base_negotiator.getLanguage(langs, env)

        # Get current published object
        obj = find_context(env)
        # Filter out CSS/JS and other non contentish objects
        # IFolderish check includes site root
        if not (IContentish.providedBy(obj) or IFolderish.providedBy(obj)):
            return base_negotiator.getLanguage(langs, env)

        nav_root = get_nav_root(obj)

        if ISubsite.providedBy(nav_root):
            # Get language stored on Subsite
            language = nav_root.force_language
            if language:
                return language
            else:
                return base_negotiator.getLanguage(langs, env)

        else:
            # Use normal Negotiator
            return base_negotiator.getLanguage(langs, env)
开发者ID:fourdigits,项目名称:ftw.subsite,代码行数:27,代码来源:negotiator.py

示例4: get_editor_language

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
def get_editor_language(request):
    """ Get editor language override
    """

    cached = getattr(request, "_cached_admin_language", None)
    if cached:
        return cached

    alwaysTranslate = getattr(request, "alwaysTranslate", None)
    if alwaysTranslate:
        return None

    context = find_context(request)

    # Filter out CSS and other non-sense
    # IFolderish check includes site root
    if not (IContentish.providedBy(context) or IFolderish.providedBy(context)):
        # Early terminate
        return None

    # Check if we are the editor
    portal_state = getMultiAdapter((context, request),
                                                    name="plone_portal_state")
    if portal_state.anonymous():
        # Anon visitor, normal language ->
        request.alwaysTranslate = True
        return None

    language = 'en'

    # english for all authenticated users
    request._cached_admin_language = language
    return language
开发者ID:eea,项目名称:Products.EEAPloneAdmin,代码行数:35,代码来源:translation_negotiator.py

示例5: test_provided

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
    def test_provided(self):
        from Products.CMFCore.interfaces import IContentish
        from Products.CMFCore.interfaces import IIndexableObjectWrapper

        obj = DummyContent()
        w = self._makeOne({}, obj)
        self.failUnless(IContentish.providedBy(w))
        self.failUnless(IIndexableObjectWrapper.providedBy(w))
开发者ID:goschtl,项目名称:zope,代码行数:10,代码来源:test_CatalogTool.py

示例6: available

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
 def available(self):
     if self.anonymous:
         return False
         
     if not IContentish.providedBy(self.context):
         return False 
         
     return checkPermission('big.brother.ViewAuditLog', self.context)
开发者ID:eleddy,项目名称:big.brother,代码行数:10,代码来源:audit.py

示例7: test_provided

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
    def test_provided(self):
        from Products.CMFCore.interfaces import IIndexableObjectWrapper
        from Products.CMFCore.interfaces import IIndexableObject

        obj = self._makeContent()
        w = self._makeOne({}, obj)
        self.assertTrue(IContentish.providedBy(w))
        self.assertTrue(IIndexableObjectWrapper.providedBy(w))
        self.assertTrue(IIndexableObject.providedBy(w))
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:11,代码来源:test_CatalogTool.py

示例8: delObjects

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
def delObjects(cont, ids):
    """ abbreviation to delete objects """
    delids = [id for id in ids if hasattr(aq_base(cont), id)]
    for delid in delids:
        try:
            obj = cont.get(delid)
            if not (IContentish.providedBy(obj) or IFolderish.providedBy(obj)):
                cont.manage_delObjects(delid)
        except (AttributeError, KeyError, BadRequest):
            logger.warning("Failed to delete '%s' in '%s'" % (delid, cont.id))
开发者ID:pigaov10,项目名称:plone4.3,代码行数:12,代码来源:utils.py

示例9: _publish_structure

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
def _publish_structure(portal):
    wtool = getToolByName(portal, 'portal_workflow')
    logger = logging.getLogger('sac.aerofacil _publish_structure')
    to_publish = [i for i in portal.keys() if IContentish.providedBy(portal[i])]
    for i in to_publish:
        try:
            wtool.doActionFor(portal[i], "publish")
        except WorkflowException:
            logger.info("Could not publish: %s. Already published?" % i)
            pass
开发者ID:Clickweb,项目名称:sac.aerofacil,代码行数:12,代码来源:setuphandlers.py

示例10: parent

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
 def parent(self):
     context_state = getMultiAdapter((self.context, self.request), name=u'plone_context_state')
     context = aq_inner(self.context)
     parent = aq_parent(context)
     if context_state.is_default_page():
         parent = aq_parent(parent)
     if INavigationRoot.providedBy(context) or (not IContentish.providedBy(parent) and not IPloneSiteRoot.providedBy(parent)):
         return
     return {'url': parent.absolute_url(),
             'title': _(u'back to ${parent}', mapping=dict(parent=safe_unicode(parent.Title())))}
开发者ID:Raptus,项目名称:raptus.backlink,代码行数:12,代码来源:back.py

示例11: test_provided

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
    def test_provided(self):
        from Products.CMFCore.interfaces import IContentish
        from Products.CMFCore.interfaces import IIndexableObjectWrapper
        from Products.CMFCore.tests.base.dummy import DummyContent

        obj = DummyContent()
        w = ExtensibleIndexableObjectWrapper(obj, self.portal)
        w.update(vars={})
        self.failUnless(IContentish.providedBy(w))
        self.failUnless(IIndexableObjectWrapper.providedBy(w))
开发者ID:dtgit,项目名称:dtedu,代码行数:12,代码来源:testCatalogTool.py

示例12: test_provided

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
    def test_provided(self):
        from Products.CMFCore.interfaces import IContentish
        from plone.indexer.interfaces import IIndexableObjectWrapper
        from Products.CMFCore.tests.base.dummy import DummyContent

        obj = DummyContent()
        w = IndexableObjectWrapper(obj, self.portal.portal_catalog)

        self.assertTrue(IIndexableObjectWrapper.providedBy(w))
        self.assertTrue(IContentish.providedBy(w))
开发者ID:adam139,项目名称:Products.CMFPlone,代码行数:12,代码来源:testCatalogTool.py

示例13: copied

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
def copied(event):
    """When an object is copied, execute rules assigned to its parent
    """
    obj = event.object
    if not (IContentish.providedBy(obj) or IComment.providedBy(obj)):
        return

    if is_portal_factory(obj):
        return

    execute(aq_parent(aq_inner(event.original)), event)
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:13,代码来源:handlers.py

示例14: update

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
 def update(self):
     common.ViewletBase.update(self)  # Get portal_state and portal_url
     super(DropdownMenuViewlet, self).update()
     context = aq_inner(self.context)
     portal_props = getToolByName(context, 'portal_properties')
     self.properties = portal_props.navtree_properties
     self.enable_caching = api.portal.get_registry_record('webcouturier.dropdownmenu.browser.interfaces.IDropdownConfiguration.enable_caching')
     self.enable_parent_clickable = api.portal.get_registry_record('webcouturier.dropdownmenu.browser.interfaces.IDropdownConfiguration.enable_parent_clickable')
     self.navroot_path = getNavigationRoot(context)
     uid = api.content.get_uuid(obj=context) if IContentish.providedBy(context) else None
     self.data = Assignment(root_uid=uid)
开发者ID:espenmn,项目名称:medialog.bergensiana,代码行数:13,代码来源:dropdown.py

示例15: moved_event

# 需要导入模块: from Products.CMFCore.interfaces import IContentish [as 别名]
# 或者: from Products.CMFCore.interfaces.IContentish import providedBy [as 别名]
def moved_event(event):
    # only execute moved event if it's not a added or removed event since
    # those are handled elsewhere and they base off of this event class
    if (IObjectAddedEvent.providedBy(event) or
            IObjectRemovedEvent.providedBy(event)):
        return

    obj = event.object
    if not (IContentish.providedBy(obj) or IComment.providedBy(obj)):
        return
    execute_event(event)
开发者ID:ale-rt,项目名称:collective.auditlog,代码行数:13,代码来源:handlers.py


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