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


Python IBehaviorAssignable.supports方法代码示例

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


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

示例1: dx_feed_indexer

# 需要导入模块: from plone.behavior.interfaces import IBehaviorAssignable [as 别名]
# 或者: from plone.behavior.interfaces.IBehaviorAssignable import supports [as 别名]
 def dx_feed_indexer(context):
     assignable = IBehaviorAssignable(context, None)
     if assignable is not None:
         if assignable.supports(IFeedControl):
             try:
                 return tuple(context.feeds)
             except TypeError:
                 return tuple()
开发者ID:kingel,项目名称:collective.chimpfeed,代码行数:10,代码来源:schema.py

示例2: dx_schedule_indexer

# 需要导入模块: from plone.behavior.interfaces import IBehaviorAssignable [as 别名]
# 或者: from plone.behavior.interfaces.IBehaviorAssignable import supports [as 别名]
    def dx_schedule_indexer(context):
        assignable = IBehaviorAssignable(context, None)
        if assignable is None or not assignable.supports(IFeedControl):
            return

        date = getattr(context, "feedSchedule", None)
        if date is None:
            assignable = IBehaviorAssignable(context, None)
            if assignable is not None:
                if assignable.supports(IDublinCore):
                    return context.effective_date

        return DateTime(
            date.year,
            date.month,
            date.day
            )
开发者ID:kingel,项目名称:collective.chimpfeed,代码行数:19,代码来源:schema.py

示例3: test_member_behaviors

# 需要导入模块: from plone.behavior.interfaces import IBehaviorAssignable [as 别名]
# 或者: from plone.behavior.interfaces.IBehaviorAssignable import supports [as 别名]
 def test_member_behaviors(self):
     behaviors = [INameFromFullName, IReferenceable,
                  metadata.ICategorization, metadata.IPublication,
                  metadata.IOwnership, IMembraneUser, IProvidePasswords]
     member = self._createType(
         self.layer['portal'], 'dexterity.membrane.member', 'les')
     assignable = IBehaviorAssignable(member)
     for b in behaviors:
         self.assertTrue(assignable.supports(b),
                         "member type should support %s behavior" % b)
开发者ID:jean,项目名称:dexterity.membrane,代码行数:12,代码来源:test_member.py

示例4: test_member_behavior_blacklist

# 需要导入模块: from plone.behavior.interfaces import IBehaviorAssignable [as 别名]
# 或者: from plone.behavior.interfaces.IBehaviorAssignable import supports [as 别名]
 def test_member_behavior_blacklist(self):
     # Some behaviors should definitely NOT be provided.
     black_list = [metadata.IDublinCore, metadata.IBasic]
     # Note that we would want INameFromTitle in the black list as
     # well, but it cannot be, as it gets pulled in as base class
     # of INameFromFullName.
     member = self._createType(self.layer["portal"], "dexterity.membrane.organizationmember", "les")
     assignable = IBehaviorAssignable(member)
     for b in black_list:
         self.assertFalse(assignable.supports(b), "member type should NOT support %s behavior" % b)
开发者ID:adam139,项目名称:emc.policy,代码行数:12,代码来源:test_dexmember.py

示例5: __call__

# 需要导入模块: from plone.behavior.interfaces import IBehaviorAssignable [as 别名]
# 或者: from plone.behavior.interfaces.IBehaviorAssignable import supports [as 别名]
 def __call__(self, context):
     assignable = IBehaviorAssignable(context, None)
     if assignable is None:
         return None
     if not assignable.supports(self.behavior.interface):
         return None
     if self.behavior.factory is not None:
         adapted = self.behavior.factory(context)
     else:
         # When no factory is specified the object should provide the
         # behavior directly
         adapted = context
     return adapted
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:15,代码来源:factory.py

示例6: test_has_behavior

# 需要导入模块: from plone.behavior.interfaces import IBehaviorAssignable [as 别名]
# 或者: from plone.behavior.interfaces.IBehaviorAssignable import supports [as 别名]
    def test_has_behavior(self):
        """ Test behavior and assignable works nicely.
        """

        self.loginAsPortalOwner()
        self.portal.invokeFactory("Document", "doc")
        doc = self.portal.doc

        # Check assignable works
        from plone.behavior.interfaces import IBehaviorAssignable
        assignable = IBehaviorAssignable(doc, None)

        self.assertTrue(assignable.supports(IMobileBehavior))
        self.assertNotEqual(assignable, None)


        # Check behavior works
        self.assertTrue(IMobileContentish.providedBy(doc))
        behavior = IMobileBehavior(doc)

        self.assertNotEquals(behavior, None)
开发者ID:cillianderoiste,项目名称:gomobile.mobile,代码行数:23,代码来源:test_behavior.py

示例7: make_some_evil_site_content

# 需要导入模块: from plone.behavior.interfaces import IBehaviorAssignable [as 别名]
# 或者: from plone.behavior.interfaces.IBehaviorAssignable import supports [as 别名]
    def make_some_evil_site_content(self):
        """ Test behavior and assignable works nicely.
        """

        self.loginAsPortalOwner()
        self.portal.invokeFactory("Document", "doc")
        doc = self.portal.doc
        doc.processForm()

        # Check assignable works
        from plone.behavior.interfaces import IBehaviorAssignable
        assignable = IBehaviorAssignable(doc, None)

        self.assertTrue(assignable.supports(IMultiChannelBehavior))
        self.assertNotEqual(assignable, None)


        # Check behavior works
        self.assertTrue(IMobileContentish.providedBy(doc))
        behavior = IMultiChannelBehavior(doc)
        behavior.contentMedias = ContentMediaOption.BOTH
        behavior.save()
开发者ID:plone-gomobile,项目名称:gomobile.convergence,代码行数:24,代码来源:test_uninstall.py

示例8: dx_category_indexer

# 需要导入模块: from plone.behavior.interfaces import IBehaviorAssignable [as 别名]
# 或者: from plone.behavior.interfaces.IBehaviorAssignable import supports [as 别名]
 def dx_category_indexer(context):
     assignable = IBehaviorAssignable(context, None)
     if assignable is not None:
         if assignable.supports(IFeedControl):
             return getattr(context, "feedCategory", None)
开发者ID:collective,项目名称:collective.chimpfeed,代码行数:7,代码来源:schema.py


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