[Zope-Checkins] CVS: Zope3/lib/python/Zope/Configuration - __init__.py:1.1.2.1 meta.py:1.1.2.1

Jim Fulton jim@zope.com
Fri, 16 Nov 2001 12:33:37 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Configuration
In directory cvs.zope.org:/tmp/cvs-serv24061/Configuration

Added Files:
      Tag: Zope-3x-branch
	__init__.py meta.py 
Log Message:
basic meta-config in place

=== Added File Zope3/lib/python/Zope/Configuration/__init__.py ===
"""Zope configuration support

Software that wants to provide new config directives calls
Zope.Configuration.meta.register.



"""


=== Added File Zope3/lib/python/Zope/Configuration/meta.py ===
"Registration of registration directives"

_directives={}

class InvalidDirective(Exception):
    "An invalid directive was used"

def register(namespace, prefix, name, callable):
    _directives[namespace, name] = callable

def execute(_namespace, _name, **kw):
    try: callable=_directives[_namespace, _name]
    except KeyError:
        raise InvalidDirective(_namespace, _name)
    return callable(**kw)

def _clear():
    "To support unit tests"
    _directives.clear()