• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ztapi.provideAdapter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中zope.app.testing.ztapi.provideAdapter函数的典型用法代码示例。如果您正苦于以下问题:Python provideAdapter函数的具体用法?Python provideAdapter怎么用?Python provideAdapter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: sessionSetUp

def sessionSetUp(session_data_container_class=PersistentSessionDataContainer):
    placelesssetup.setUp()
    ztapi.provideAdapter(IRequest, IClientId, TestClientId)
    ztapi.provideAdapter(IRequest, ISession, Session)
    ztapi.provideUtility(IClientIdManager, CookieClientIdManager())
    sdc = session_data_container_class()
    ztapi.provideUtility(ISessionDataContainer, sdc, '')
开发者ID:wpjunior,项目名称:proled,代码行数:7,代码来源:tests.py


示例2: setUpCategory

def setUpCategory(test):
    placelesssetup.setUp(test)
    ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
                         AttributeAnnotations)
    container = SampleContainer()
    test.globs = {'my_container': container}
    directlyProvides(container, IAttributeAnnotatable)
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:7,代码来源:test_category.py


示例3: setUpBBB

def setUpBBB(test):
    baseIntegration(test)
    ztapi.provideAdapter(IEditorRatable, IEditorialRating, EditorialRating)
    ztapi.provideAdapter(IUserRatable, IUserRating, UserRating)
    container = test.globs['my_container']
    directlyProvides(container,
                     IAttributeAnnotatable, IEditorRatable, IUserRatable)
开发者ID:eaudeweb,项目名称:naaya,代码行数:7,代码来源:test_rating.py


示例4: setUpBasicWidgets

def setUpBasicWidgets(test):
    testing.setUp(test)
    ztapi.provideAdapter((IChoice, Interface, Interface), IInputWidget, DropdownWidget)
    ztapi.provideAdapter((IChoice, Interface), IInputWidget, ChoiceInputWidget)
    ztapi.provideAdapter((ISet, IChoice, Interface), IInputWidget, ChoiceCollectionInputWidget)
    ztapi.provideAdapter((ISet, Interface, Interface), IInputWidget, MultiSelectSetWidget)
    ztapi.provideAdapter((ISet, Interface), IInputWidget, CollectionInputWidget)
开发者ID:collective,项目名称:plone.contentratings,代码行数:7,代码来源:tests.py


示例5: setUp

 def setUp(self):
     placelesssetup.setUp()
     factory = self.getTestClass()
     iface = self.getTestInterface()
     required = self.getAdaptedClass()
     # register language switch for test interface adapter
     ztapi.provideAdapter(required, iface, factory)
开发者ID:felixonmars,项目名称:z3c.language,代码行数:7,代码来源:testing.py


示例6: test_empty

        def test_empty(self):
            ztapi.provideAdapter(None, ITraversable, AttrItemTraverser)

            app, registry = self._initRegistry()
            exporter = self._makeOne(registry).__of__(registry)
            xml = exporter.generateXML()

            self._compareDOM(xml, _EMPTY_PLUGINREGISTRY_EXPORT)
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:8,代码来源:test_exportimport.py


示例7: setUpCategoryTests

def setUpCategoryTests(test):
    testing.setUp(test)
    # Setup our adapter from category to rating api
    ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
                         AttributeAnnotations)
    container = SampleContainer()
    directlyProvides(container, IAttributeAnnotatable)
    test.globs = {'my_container': container}
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:8,代码来源:tests.py


示例8: nonHTTPSessionTestCaseSetUp

def nonHTTPSessionTestCaseSetUp(sdc_class=PersistentSessionDataContainer):
    # I am getting an error with ClientId and not TestClientId
    placelesssetup.setUp()
    ztapi.provideAdapter(IRequest, IClientId, ClientId)
    ztapi.provideAdapter(IRequest, ISession, Session)
    ztapi.provideUtility(IClientIdManager, CookieClientIdManager())
    sdc = sdc_class()
    ztapi.provideUtility(ISessionDataContainer, sdc, '')
开发者ID:wpjunior,项目名称:proled,代码行数:8,代码来源:tests.py


示例9: setUp

def setUp(test):
    test.globs['rootFolder'] = setup.placefulSetUp(True)

    class RootModule(str):
        implements(IAPIDocRootModule)
    ztapi.provideUtility(IAPIDocRootModule, RootModule('zope'), "zope")

    module = CodeModule()
    module.__name__ = ''
    directlyProvides(module, IContainmentRoot)
    ztapi.provideUtility(IDocumentationModule, module, "Code")

    module = ZCMLModule()
    module.__name__ = ''
    directlyProvides(module, IContainmentRoot)
    ztapi.provideUtility(IDocumentationModule, module, "ZCML")

    # Register Renderer Components
    ztapi.provideUtility(IFactory, ReStructuredTextSourceFactory,
                         'zope.source.rest')
    ztapi.browserView(IReStructuredTextSource, '',
                      ReStructuredTextToHTMLRenderer)
    # Cheat and register the ReST factory for STX as well.
    ztapi.provideUtility(IFactory, ReStructuredTextSourceFactory,
                         'zope.source.stx')

    # Register ++apidoc++ namespace
    from zope.app.apidoc.apidoc import apidocNamespace
    from zope.app.traversing.interfaces import ITraversable
    ztapi.provideAdapter(None, ITraversable, apidocNamespace, name="apidoc")
    ztapi.provideView(None, None, ITraversable, "apidoc", apidocNamespace)

    # Register ++apidoc++ namespace
    from zope.app.traversing.namespace import view
    from zope.app.traversing.interfaces import ITraversable
    ztapi.provideAdapter(None, ITraversable, view, name="view")
    ztapi.provideView(None, None, ITraversable, "view", view)

    context = xmlconfig.string(meta)

    # Fix up path for tests.
    global old_context
    old_context = zope.app.appsetup.appsetup.__config_context
    zope.app.appsetup.appsetup.__config_context = context

    # Fix up path for tests.
    global old_source_file
    old_source_file = zope.app.appsetup.appsetup.__config_source
    zope.app.appsetup.appsetup.__config_source = os.path.join(
        os.path.dirname(zope.app.__file__), 'meta.zcml')

    # Register the index.html view for codemodule.class_.Class
    from zope.app.apidoc.codemodule.class_ import Class
    from zope.app.apidoc.codemodule.browser.class_ import ClassDetails
    from zope.app.publisher.browser import BrowserView
    class Details(ClassDetails, BrowserView):
        pass
    ztapi.browserView(Class, 'index.html', Details)
开发者ID:wpjunior,项目名称:proled,代码行数:58,代码来源:tests.py


示例10: test_normal_no_plugins

        def test_normal_no_plugins(self):
            ztapi.provideAdapter(None, ITraversable, AttrItemTraverser)

            app, registry = self._initRegistry(
                                    plugin_type_info=_PLUGIN_TYPE_INFO)
            exporter = self._makeOne(registry).__of__(registry)
            xml = exporter.generateXML()

            self._compareDOM(xml, _NO_PLUGINS_PLUGINREGISTRY_EXPORT)
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:9,代码来源:test_exportimport.py


示例11: setUp

 def setUp(self):
     super(AdapterTestCase, self).setUp()
     # provide necessary components
     ztapi.provideAdapter(None, IUniqueId, StubUniqueId)
     ztapi.provideAdapter(None, IChildObjects, StubChildObjects)
     ztapi.provideAdapter(ILocation, IUniqueId, LocationUniqueId)
     ztapi.provideAdapter(IReadContainer, IChildObjects, ContainerChildObjects)
     ztapi.provideAdapter(ISite, IChildObjects, ContainerSiteChildObjects)
     ztapi.provideUtility(ITreeStateEncoder, TreeStateEncoder())
     self.makeObjects()
开发者ID:wpjunior,项目名称:proled,代码行数:10,代码来源:test_adapters.py


示例12: setUpViewTests

def setUpViewTests(test):
    setUp(test)
    # Setup our adapter from category to rating api
    ztapi.provideAdapter((IRatingCategory, Interface),
                             IRatingManager, RatingCategoryAdapter)
    ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
                         AttributeAnnotations)
    container = SampleContainer()
    directlyProvides(container, IAttributeAnnotatable)
    test.globs = {'my_container': container}
开发者ID:eaudeweb,项目名称:naaya,代码行数:10,代码来源:tests.py


示例13: setUp

def setUp(test):
    root_folder = setup.placefulSetUp(True)
    ztapi.provideAdapter(None, IUniqueId, LocationUniqueId)
    ztapi.provideAdapter(None, IPhysicallyLocatable,
                         LocationPhysicallyLocatable)

    # Set up apidoc module
    test.globs['apidoc'] = APIDocumentation(root_folder, '++apidoc++')

    # Register documentation modules
    ztapi.provideUtility(IDocumentationModule, UtilityModule(), 'Utility')
开发者ID:jean,项目名称:zope.app.apidoc,代码行数:11,代码来源:tests.py


示例14: baseIntegration

def baseIntegration(test):
    placelesssetup.setUp(test)
    directlyProvides(IEditorialRating, IRatingType)
    directlyProvides(IUserRating, IRatingType)
    # We use SampleContainers in our tests, so let's make it annotatable
    classImplements(SampleContainer, IAttributeAnnotatable)
    ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
                         AttributeAnnotations)
    ztapi.provideAdapter((IRatingCategory, Interface),
                         IRatingManager, RatingCategoryAdapter)
    container = SampleContainer()
    test.globs = {'my_container': container}
开发者ID:eaudeweb,项目名称:naaya,代码行数:12,代码来源:test_rating.py


示例15: setUp

def setUp(test):
    placelesssetup.setUp()
    setup.setUpTraversal()
    
    ztapi.provideAdapter(IInterface, IUniqueId, LocationUniqueId)

    # Register Renderer Components
    ztapi.provideUtility(IFactory, ReStructuredTextSourceFactory,
                         'zope.source.rest')    
    ztapi.browserView(IReStructuredTextSource, '', 
                      ReStructuredTextToHTMLRenderer)
    # Cheat and register the ReST factory for STX as well
    ztapi.provideUtility(IFactory, ReStructuredTextSourceFactory,
                         'zope.source.stx')    
开发者ID:wpjunior,项目名称:proled,代码行数:14,代码来源:tests.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ztapi.provideUtility函数代码示例发布时间:2022-05-26
下一篇:
Python setup.placelessTearDown函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap