[Zope3-checkins] SVN: Zope3/trunk/src/zope/configuration/ Fix issue 439.

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Nov 13 13:54:57 EST 2005


Log message for revision 40084:
  Fix issue 439.
  

Changed:
  U   Zope3/trunk/src/zope/configuration/config.py
  U   Zope3/trunk/src/zope/configuration/tests/test_config.py

-=-
Modified: Zope3/trunk/src/zope/configuration/config.py
===================================================================
--- Zope3/trunk/src/zope/configuration/config.py	2005-11-13 17:32:27 UTC (rev 40083)
+++ Zope3/trunk/src/zope/configuration/config.py	2005-11-13 18:54:56 UTC (rev 40084)
@@ -260,6 +260,7 @@
                 basepath = os.getcwd()
             else:
                 basepath = os.path.dirname(self.package.__file__)
+                basepath = os.path.abspath(basepath)
             self.basepath = basepath
 
         return os.path.join(basepath, filename)

Modified: Zope3/trunk/src/zope/configuration/tests/test_config.py
===================================================================
--- Zope3/trunk/src/zope/configuration/tests/test_config.py	2005-11-13 17:32:27 UTC (rev 40083)
+++ Zope3/trunk/src/zope/configuration/tests/test_config.py	2005-11-13 18:54:56 UTC (rev 40084)
@@ -92,7 +92,7 @@
     >>> machine((ns, "factory"), factory=u".f")
     >>> pprint(machine.actions[-1:])
     [(('factory', 1, 2), f)]
-    
+
     Define and try a complex directive:
 
     >>> machine.begin((metans, "complexDirective"),
@@ -146,7 +146,7 @@
       'third')]
 
     Done with the package
-    
+
     >>> machine.end()
 
 
@@ -162,7 +162,7 @@
     ...
     ConfigurationError: ('Invalid value for', 'factory',""" \
        """ "Can't use leading dots in dotted names, no package has been set.")
-    
+
     >>> pprint(machine.actions)
     [(('simple', u'aa', u'xxx', 'cc'),
       f,
@@ -231,6 +231,20 @@
     [(('k', 'f'), f, ('f', 'c', 'x'), {}, (), 'yee ha')]
     """
 
+def test_basepath_absolute():
+    """Path must always return an absolute path.
+
+    >>> import os
+    >>> class stub:
+    ...     __file__ = os.path.join('relative', 'path')
+    >>> c = config.ConfigurationContext()
+    >>> c.package = stub()
+
+    >>> os.path.isabs(c.path('y/z'))
+    True
+    """
+
+
 def test_trailing_dot_in_resolve():
     """Dotted names are no longer allowed to end in dots
 



More information about the Zope3-Checkins mailing list