[Zope-Checkins] CVS: Zope3/lib/python/Zope/Configuration - name.py:1.1.2.5

Jim Fulton jim@zope.com
Thu, 3 Jan 2002 17:07:29 -0500


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

Modified Files:
      Tag: Zope-3x-branch
	name.py 
Log Message:
Changed the configuration file dotted name rules to require a 
trailing dot to repeat the last name.


=== Zope3/lib/python/Zope/Configuration/name.py 1.1.2.4 => 1.1.2.5 ===
 
     if name[-1:] == '.':
-        #XXX finish ending dots
         name = name[:-1]
-        
+        repeat = 1
+    else:
+        repeat = 0
+
     names=name.split('.')
     last=names[-1]
     mod='.'.join(names[:-1])
                  
     while 1:
-        m=sys.modules.get(mod)
-        if m is None:
-            m=__import__(mod, _globals, _globals, _silly)
+        m=__import__(mod, _globals, _globals, _silly)
         try:
             a=getattr(m, last)
         except AttributeError:
             pass
         else:
-            if type(a) is not ModuleType:
+            if not repeat or (type(a) is not ModuleType):
                 return a
         mod += '.' + last
-        
-    
-    
-