[Zope-Checkins] CVS: Zope3/lib/python/Zope/Configuration - name.py:1.1.2.1 meta.py:1.1.2.2
Jim Fulton
jim@zope.com
Fri, 16 Nov 2001 14:36:40 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Configuration
In directory cvs.zope.org:/tmp/cvs-serv17999
Modified Files:
Tag: Zope-3x-branch
meta.py
Added Files:
Tag: Zope-3x-branch
name.py
Log Message:
configuration name resolution
=== Added File Zope3/lib/python/Zope/Configuration/name.py ===
"""Provide configuration object name resolution
"""
from types import ModuleType
def resolve(name, _silly=('__doc__',), _globals={}):
if name[:1]=='.':
name='Zope.Products'+name
names=name.split('.')
last=names[-1]
mod='.'.join(names[:-1])
while 1:
m=__import__(mod, _globals, _globals, _silly)
try:
a=getattr(m, last)
except AttributeError:
pass
else:
if type(a) is not ModuleType:
return a
mod += '.' + last
=== Zope3/lib/python/Zope/Configuration/meta.py 1.1.2.1 => 1.1.2.2 ===
"An invalid directive was used"
-def register(namespace, prefix, name, callable):
+def register(namespace, name, callable):
_directives[namespace, name] = callable
def execute(_namespace, _name, **kw):