Skip to content

Commit

Permalink
Move more directive handlers to the new registration API; fix some tests
Browse files Browse the repository at this point in the history
that I broke by moving the elementary ones earlier.
  • Loading branch information
philikon committed Apr 12, 2006
1 parent a082e4e commit 42168d0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions browser/i18nresourcemeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def __call__(self, require = None):
self._context.action(
discriminator = ('i18n-resource', self.name, self.type, self.layer),
callable = handler,
args = ('provideAdapter',
(self.layer,), Interface, self.name, factory,
args = ('registerAdapter',
factory, (self.layer,), Interface, self.name,
self._context.info)
)

Expand Down
4 changes: 2 additions & 2 deletions browser/icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def IconDirective(_context, name, for_, file=None, resource=None,
_context.action(
discriminator = ('view', name, vfactory, layer),
callable = handler,
args = ('provideAdapter',
(for_, layer), Interface, name, vfactory, _context.info)
args = ('registerAdapter',
vfactory, (for_, layer), Interface, name, _context.info)
)

_context.action(
Expand Down
8 changes: 4 additions & 4 deletions browser/metaconfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ def setDefaultSkin(name, info=''):
True
"""
skin = zapi.getUtility(IBrowserSkinType, name)
handler('provideAdapter',
(IBrowserRequest,), IDefaultSkin, '', skin, info),
handler('registerAdapter',
skin, (IBrowserRequest,), IDefaultSkin, '', info),

def defaultSkin(_context, name):

Expand All @@ -387,8 +387,8 @@ def defaultView(_context, name, for_=None, layer=IBrowserRequest):
_context.action(
discriminator = ('defaultViewName', for_, layer, name),
callable = handler,
args = ('provideAdapter',
(for_, layer), IDefaultViewName, '', name, _context.info)
args = ('registerAdapter',
name, (for_, layer), IDefaultViewName, '', _context.info)
)

if for_ is not None:
Expand Down
8 changes: 4 additions & 4 deletions browser/resourcemeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def resource(_context, name, layer=IDefaultBrowserLayer,
_context.action(
discriminator = ('resource', name, IBrowserRequest, layer),
callable = handler,
args = ('provideAdapter',
(layer,), Interface, name, factory, _context.info),
args = ('registerAdapter',
factory, (layer,), Interface, name, _context.info),
)

def resourceDirectory(_context, name, directory, layer=IDefaultBrowserLayer,
Expand All @@ -98,6 +98,6 @@ def resourceDirectory(_context, name, directory, layer=IDefaultBrowserLayer,
_context.action(
discriminator = ('resource', name, IBrowserRequest, layer),
callable = handler,
args = ('provideAdapter',
(layer,), Interface, name, factory, _context.info),
args = ('registerAdapter',
factory, (layer,), Interface, name, _context.info),
)
34 changes: 17 additions & 17 deletions browser/tests/test_addMenuItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
('provideAdapter',
('registerAdapter',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
'')),
(None,
<function provideInterface>,
Expand All @@ -59,7 +59,7 @@
"""

import unittest
from zope.testing.doctestunit import DocTestSuite
from zope.testing.doctest import DocTestSuite
import re
import pprint
import cStringIO
Expand Down Expand Up @@ -110,12 +110,12 @@ def test_w_factory():
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
('provideAdapter',
('registerAdapter',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
'')),
(None,
<function provideInterface>,
Expand Down Expand Up @@ -149,12 +149,12 @@ def test_w_factory_and_view():
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
('provideAdapter',
('registerAdapter',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
'')),
(None,
<function provideInterface>,
Expand Down Expand Up @@ -201,12 +201,12 @@ def test_w_factory_class_view():
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
('provideAdapter',
('registerAdapter',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
'')),
(None,
<function provideInterface>,
Expand Down Expand Up @@ -239,12 +239,12 @@ def test_w_for_factory():
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
('provideAdapter',
('registerAdapter',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
(<InterfaceClass zope.app.publisher.browser.tests.test_addMenuItem.IX>,
<InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
'')),
(None,
<function provideInterface>,
Expand Down Expand Up @@ -273,12 +273,12 @@ def test_w_factory_layer():
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
('provideAdapter',
('registerAdapter',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.app.publisher.browser.tests.test_addMenuItem.ILayerStub>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
'')),
(None,
<function provideInterface>,
Expand Down Expand Up @@ -311,12 +311,12 @@ def test_w_for_menu_factory():
<class 'zope.app.publisher.browser.tests.test_addMenuItem.MenuStub'>,
'Add an X'),
<function handler>,
('provideAdapter',
('registerAdapter',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
(<InterfaceClass zope.app.publisher.browser.tests.test_addMenuItem.IX>,
<InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
<class 'zope.app.publisher.browser.tests.test_addMenuItem.MenuStub'>,
'Add an X',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
'')),
(None,
<function provideInterface>,
Expand Down Expand Up @@ -346,12 +346,12 @@ def test_w_factory_icon_extra_order():
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X'),
<function handler>,
('provideAdapter',
('registerAdapter',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
(<InterfaceClass zope.app.container.interfaces.IAdding>,
<InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
<InterfaceClass zope.app.publisher.interfaces.browser.AddMenu>,
'Add an X',
<zope.app.publisher.browser.menumeta.MenuItemFactory object>,
'')),
(None,
<function provideInterface>,
Expand Down
8 changes: 4 additions & 4 deletions browser/viewmeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def page(_context, name, permission, for_,
_context.action(
discriminator = ('view', for_, name, IBrowserRequest, layer),
callable = handler,
args = ('provideAdapter',
(for_, layer), Interface, name, new_class, _context.info),
args = ('registerAdapter',
new_class, (for_, layer), Interface, name, _context.info),
)


Expand Down Expand Up @@ -348,8 +348,8 @@ def publishTraverse(self, request, name,
_context.action(
discriminator = ('view', (for_, layer), name, self.provides),
callable = handler,
args = ('provideAdapter',
(for_, layer), self.provides, name, newclass,
args = ('registerAdapter',
newclass, (for_, layer), self.provides, name,
_context.info),
)

Expand Down

0 comments on commit 42168d0

Please sign in to comment.