Package zope :: Package configuration :: Module config :: Class ConfigurationAdapterRegistry
[show private | hide private]
[frames | no frames]

Type ConfigurationAdapterRegistry

object --+
         |
        ConfigurationAdapterRegistry

Known Subclasses:
ConfigurationMachine

Simple 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
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
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__

Type:
Implements
Value:
<implementedBy zope.configuration.config.ConfigurationAdapterRegistry> 

__providedBy__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0xb64a83ec>       

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0xb64a83ec>       

Generated by Epydoc 2.1 on Fri Jun 24 12:01:26 2005 http://epydoc.sf.net