[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/app/
Updated to reflect new regesistration objects.
Jim Fulton
jim at zope.com
Wed Mar 1 00:09:05 EST 2006
Log message for revision 65653:
Updated to reflect new regesistration objects.
Changed:
U Zope3/branches/jim-adapter/src/zope/app/apidoc/component.py
U Zope3/branches/jim-adapter/src/zope/app/apidoc/component.txt
U Zope3/branches/jim-adapter/src/zope/app/apidoc/ifacemodule/browser.txt
U Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py
-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/apidoc/component.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/apidoc/component.py 2006-03-01 05:08:59 UTC (rev 65652)
+++ Zope3/branches/jim-adapter/src/zope/app/apidoc/component.py 2006-03-01 05:09:04 UTC (rev 65653)
@@ -19,7 +19,12 @@
import types
from zope.component.interfaces import IFactory
-from zope.component.site import AdapterRegistration, SubscriptionRegistration
+from zope.component.components import (
+ AdapterRegistration,
+ SubscriptionRegistration,
+ HandlerRegistration,
+ )
+
from zope.component.site import UtilityRegistration
from zope.interface import Interface
from zope.interface.interface import InterfaceClass
@@ -42,7 +47,10 @@
gsm = zapi.getGlobalSiteManager()
for reg in gsm.registrations():
# Only get adapters
- if not isinstance(reg, (AdapterRegistration, SubscriptionRegistration)):
+ if not isinstance(reg, (AdapterRegistration,
+ SubscriptionRegistration,
+ HandlerRegistration),
+ ):
continue
# Ignore adapters that have no required interfaces
if len(reg.required) == 0:
@@ -193,7 +201,7 @@
'required': [getInterfaceInfoDictionary(iface)
for iface in reg.required
if iface is not None],
- 'name': getattr(reg, 'name', _('<subscription>')),
+ 'name': getattr(reg, 'name', ''),
'factory': path,
'factory_url': url,
'doc': doc,
Modified: Zope3/branches/jim-adapter/src/zope/app/apidoc/component.txt
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/apidoc/component.txt 2006-03-01 05:08:59 UTC (rev 65652)
+++ Zope3/branches/jim-adapter/src/zope/app/apidoc/component.txt 2006-03-01 05:09:04 UTC (rev 65653)
@@ -46,7 +46,7 @@
>>> regs
[AdapterRegistration(('IFoo', 'IBar'), 'ISpecialResult', '', None, ''),
AdapterRegistration(('IFoo',), 'IResult', '', None, ''),
- SubscriptionRegistration(('IFoo',), None, 'stubFactory', '')]
+ HandlerRegistration(('IFoo',), u'', 'stubFactory', '')]
Note how the adapter requiring an `IRequest` at the end of the required
interfaces is neglected. This is because it is recognized as a view and views
@@ -58,7 +58,7 @@
[AdapterRegistration(('IFoo', 'IBar'), 'ISpecialResult', '', None, ''),
AdapterRegistration(('IFoo', 'IRequest'), 'ISpecialResult', '', None, ''),
AdapterRegistration(('IFoo',), 'IResult', '', None, ''),
- SubscriptionRegistration(('IFoo',), None, 'stubFactory', '')]
+ HandlerRegistration(('IFoo',), u'', 'stubFactory', '')]
The function will also pick up registrations that have required interfaces the
specified interface extends:
@@ -68,7 +68,7 @@
>>> regs
[AdapterRegistration(('IFoo', 'IBar'), 'ISpecialResult', '', None, ''),
AdapterRegistration(('IFoo',), 'IResult', '', None, ''),
- SubscriptionRegistration(('IFoo',), None, 'stubFactory', '')]
+ HandlerRegistration(('IFoo',), u'', 'stubFactory', '')]
And all of the required interfaces are considered, of course:
@@ -344,14 +344,14 @@
much like adapter registrations, except that they do not have a name. So let's
see how the function handles subscriptions:
- >>> from zope.component.site import SubscriptionRegistration
- >>> reg = SubscriptionRegistration((IFoo, IBar), None, MyResult, 'doc info')
+ >>> from zope.component.components import HandlerRegistration
+ >>> reg = HandlerRegistration((IFoo, IBar), '', MyResult, 'doc info')
>>> pprint(component.getAdapterInfoDictionary(reg))
{'doc': 'doc info',
'factory': 'zope.app.apidoc.doctest.MyResult',
'factory_url': 'zope/app/apidoc/doctest/MyResult',
- 'name': u'<subscription>',
+ 'name': '',
'provided': None,
'required': [{'module': 'zope.app.apidoc.doctest', 'name': 'IFoo'},
{'module': 'zope.app.apidoc.doctest', 'name': 'IBar'}],
Modified: Zope3/branches/jim-adapter/src/zope/app/apidoc/ifacemodule/browser.txt
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/apidoc/ifacemodule/browser.txt 2006-03-01 05:08:59 UTC (rev 65652)
+++ Zope3/branches/jim-adapter/src/zope/app/apidoc/ifacemodule/browser.txt 2006-03-01 05:09:04 UTC (rev 65653)
@@ -305,7 +305,7 @@
[{'doc': '',
'factory': 'None.append',
'factory_url': None,
- 'name': u'<subscription>',
+ 'name': u'',
'provided': None,
'required': [{'module': 'zope.interface',
'name': 'Interface'}],
Modified: Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py 2006-03-01 05:08:59 UTC (rev 65652)
+++ Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py 2006-03-01 05:09:04 UTC (rev 65653)
@@ -147,7 +147,7 @@
)))
gsm = zapi.getGlobalSiteManager()
- doc = [reg.doc
+ doc = [reg.info
for reg in gsm.registrations()
if (isinstance(reg, SubscriptionRegistration) and
reg.provided is IS)][0]
More information about the Zope3-Checkins
mailing list