| Trees | Index | Help |
|
|---|
| Package zope :: Package configuration :: Module config :: Class ConfigurationAdapterRegistry |
|
object --+
|
ConfigurationAdapterRegistry
ConfigurationMachineSimple adapter registry that manages directives as adapters
>>> r = ConfigurationAdapterRegistry()
>>> c = ConfigurationMachine()
>>> r.factory(c, ('http://www.zope.com','xxx'))
Traceback (most recent call last):
...
ConfigurationError: ('Unknown directive', 'http://www.zope.com', 'xxx')
>>> from zope.configuration.interfaces import IConfigurationContext
>>> def f():
... pass
>>> r.register(IConfigurationContext, ('http://www.zope.com', 'xxx'), f)
>>> r.factory(c, ('http://www.zope.com','xxx')) is f
1
>>> r.factory(c, ('http://www.zope.com','yyy')) is f
Traceback (most recent call last):
...
ConfigurationError: ('Unknown directive', 'http://www.zope.com', 'yyy')
>>> r.register(IConfigurationContext, 'yyy', f)
>>> r.factory(c, ('http://www.zope.com','yyy')) is f
1
Test the documentation feature:
>>> r._docRegistry
[]
>>> r.document(('ns', 'dir'), IFullInfo, IConfigurationContext, None,
... 'inf', None)
>>> r._docRegistry[0][0] == ('ns', 'dir')
1
>>> r._docRegistry[0][1] is IFullInfo
1
>>> r._docRegistry[0][2] is IConfigurationContext
1
>>> r._docRegistry[0][3] is None
1
>>> r._docRegistry[0][4] == 'inf'
1
>>> r._docRegistry[0][5] is None
1
>>> r.document('all-dir', None, None, None, None)
>>> r._docRegistry[1][0]
('', 'all-dir')
| Method Summary | |
|---|---|
__init__(self)
| |
document(self,
name,
schema,
usedIn,
handler,
info,
parent)
| |
factory(self,
context,
name)
| |
register(self,
interface,
name,
factory)
| |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Class Variable Summary | |
|---|---|
Implements |
__implemented__ = <implementedBy zope.configuration.conf...
|
ClassProvides |
__providedBy__ = <zope.interface.declarations.ClassProvi...
|
ClassProvides |
__provides__ = <zope.interface.declarations.ClassProvide...
|
| Class Variable Details |
|---|
__implemented__
|
__providedBy__
|
__provides__
|
| Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Fri Jun 24 12:01:26 2005 | http://epydoc.sf.net |