def setUp(self):
        super(Test, self).setUp()
        traversingSetUp()
        # XXX this whole test setup is rather involved. Is there a
        # simpler way to publish widget_macros.pt? Probably.

        # load the registrations for formlib
        xmlconfig.file("configure.zcml", zope.formlib)

        # set up the widget_macros macro
        macro_template = PageTemplate()
        widget_macros = os.path.join(os.path.dirname(zope.formlib.__file__),
                                     'widget_macros.pt')

        f = open(widget_macros, 'r')
        data = f.read()
        f.close()
        macro_template.write(data)

        @zope.component.adapter(None, None)
        @implementer(zope.traversing.interfaces.ITraversable)
        class view:
            def __init__(self, ob, r=None):
                pass

            def traverse(*args):
                return macro_template.macros

        provideAdapter(view, name='view')
        provideAdapter(DefaultTraversable, [None])
示例#2
0
    def setUp(self):
        ZCMLFileLayer.setUp(self)

        # Set up site manager adapter
        zope.component.provideAdapter(
            SiteManagerAdapter, (Interface,), IComponentLookup)

        # Set up traversal
        traversingSetUp()
        zope.component.provideAdapter(
            ContainerTraversable, (ISimpleReadContainer,), ITraversable)

        # Session
        zope.component.provideAdapter(ClientId, (IRequest,), IClientId)
        zope.component.provideAdapter(Session, (IRequest,), ISession)
        zope.component.provideUtility(
            CookieClientIdManager(), IClientIdManager)
        sdc = PersistentSessionDataContainer()
        zope.component.provideUtility(sdc, ISessionDataContainer, '')

        # Set up site
        site = rootFolder()
        site.setSiteManager(LocalSiteManager(site))
        zope.component.hooks.setSite(site)

        return site
    def setUp(self):
        super(Test, self).setUp()
        traversingSetUp()
        # XXX this whole test setup is rather involved. Is there a
        # simpler way to publish widget_macros.pt? Probably.
        
        # load the registrations for formlib
        xmlconfig.file("configure.zcml",
                       zope.formlib)

        # set up the widget_macros macro
        macro_template = PageTemplate()
        widget_macros = os.path.join(os.path.dirname(zope.formlib.__file__),
                                     'widget_macros.pt')
        
        f = open(widget_macros, 'r')
        data = f.read()
        f.close()
        macro_template.write(data)
        @zope.component.adapter(None, None)
        @implementer(zope.traversing.interfaces.ITraversable)
        class view:
            def __init__(self, ob, r=None):
                pass
            def traverse(*args):
                return macro_template.macros
        provideAdapter(view, name='view')
        provideAdapter(DefaultTraversable, [None])
示例#4
0
def setUp(test):
    traversingSetUp()
    provideAdapter(TextWidget,
                   (ITextLine, IDefaultBrowserLayer),
                   IInputWidget)
    provideAdapter(WidgetInputErrorView,
                   (IWidgetInputError, IDefaultBrowserLayer),
                   IWidgetInputErrorView)
示例#5
0
def placefulSetUp(site=False):
    testing.setUp()
    eventtesting.setUp()
    traversingSetUp()
    setHooks()
    provideAdapter(ContainerTraversable,
                   (ISimpleReadContainer,), ITraversable)
    provideAdapter(SiteManagerAdapter, (Interface,), IComponentLookup)

    if site:
        root = rootFolder()
        createSiteManager(root, setsite=True)
        return root
示例#6
0
    def setUp(self):
        ZCMLFileLayer.setUp(self)
        eventtesting.setUp()
        traversingSetUp()
        zope.component.hooks.setHooks()

        # Set up site manager adapter
        zope.component.provideAdapter(
            SiteManagerAdapter, (Interface,), IComponentLookup)

        # Set up site
        site = rootFolder()
        site.setSiteManager(LocalSiteManager(site))
        zope.component.hooks.setSite(site)
示例#7
0
文件: tests.py 项目: jean/zope.intid
    def setUp(self):
        testing.setUp()
        eventtesting.setUp()
        traversingSetUp()
        setHooks()
        provideAdapter(ContainerTraversable,
                       (ISimpleReadContainer,), ITraversable)
        provideAdapter(SiteManagerAdapter, (Interface,), IComponentLookup)

        self.root = rootFolder()
        createSiteManager(self.root, setsite=True)

        provideAdapter(connectionOfPersistent, (IPersistent, ), IConnection)
        provideAdapter(
            KeyReferenceToPersistent, (IPersistent, ), IKeyReference)
示例#8
0
    def setUp(self):
        testing.setUp()
        eventtesting.setUp()
        traversingSetUp()
        setHooks()
        provideAdapter(ContainerTraversable, (ISimpleReadContainer, ),
                       ITraversable)
        provideAdapter(SiteManagerAdapter, (Interface, ), IComponentLookup)

        self.root = rootFolder()
        createSiteManager(self.root, setsite=True)

        provideAdapter(connectionOfPersistent, (IPersistent, ), IConnection)
        provideAdapter(KeyReferenceToPersistent, (IPersistent, ),
                       IKeyReference)
示例#9
0
def setUp(test):
    cleanup.setUp()
    eventtesting.setUp()
    traversingSetUp()

    # resource namespace setup
    from zope.traversing.interfaces import ITraversable
    from zope.traversing.namespace import resource
    zope.component.provideAdapter(
        resource, (None,), ITraversable, name = "resource")
    zope.component.provideAdapter(
        resource, (None, None), ITraversable, name = "resource")

    from zope.browserpage import metaconfigure
    from zope.contentprovider import tales
    metaconfigure.registerType('provider', tales.TALESProviderExpression)
示例#10
0
def doctestSetUp(test):
    cleanup.setUp()
    eventtesting.setUp()
    traversingSetUp()

    # resource namespace setup
    from zope.traversing.interfaces import ITraversable
    from zope.traversing.namespace import resource
    zope.component.provideAdapter(resource, (None, ),
                                  ITraversable,
                                  name="resource")
    zope.component.provideAdapter(resource, (None, None),
                                  ITraversable,
                                  name="resource")

    from zope.browserpage import metaconfigure
    from zope.contentprovider import tales
    metaconfigure.registerType('provider', tales.TALESProviderExpression)
示例#11
0
 def setUp(self):
     traversingSetUp()
     self.setUpContent()
 def setUp(self):
     traversingSetUp()
     self.setUpContent()
def setUp(test):
    traversingSetUp()
    provideAdapter(TextWidget, (ITextLine, IDefaultBrowserLayer), IInputWidget)
    provideAdapter(WidgetInputErrorView,
                   (IWidgetInputError, IDefaultBrowserLayer),
                   IWidgetInputErrorView)