SVN: zpkgtools/trunk/zpkgtools/ add a test that <resources> sections in the configuration file may not be

"Fred L. Drake, Jr." <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Log message for revision 38143:
  add a test that <resources> sections in the configuration file may not be
  nested, and fix a corresponding bug in the implementation
  

Changed:
  U   zpkgtools/trunk/zpkgtools/config.py
  U   zpkgtools/trunk/zpkgtools/tests/test_config.py

-=-
Modified: zpkgtools/trunk/zpkgtools/config.py
===================================================================
--- zpkgtools/trunk/zpkgtools/config.py	2005-08-29 15:57:18 UTC (rev 38142)
+++ zpkgtools/trunk/zpkgtools/config.py	2005-08-29 16:51:44 UTC (rev 38143)
@@ -69,7 +69,7 @@
         if typename != "resources":
             raise cfgparser.ConfigurationError(
                 "only <resources> sections are allowed")
-        if isinstance(parent, locationmap.LocationMap):
+        if isinstance(parent, locationmap.MapLoader):
             raise cfgparser.ConfigurationError(
                 "<resources> sections may not be nested")
         return locationmap.MapLoader(self.base, self.filename, self.locations)

Modified: zpkgtools/trunk/zpkgtools/tests/test_config.py
===================================================================
--- zpkgtools/trunk/zpkgtools/tests/test_config.py	2005-08-29 15:57:18 UTC (rev 38142)
+++ zpkgtools/trunk/zpkgtools/tests/test_config.py	2005-08-29 16:51:44 UTC (rev 38143)
@@ -132,6 +132,26 @@
         finally:
             os.unlink(path)
 
+    def test_nested_resources(self):
+        cf = config.Configuration()
+        fd, path = tempfile.mkstemp(".conf", text=True)
+        f = os.fdopen(fd, "w+")
+        f.write(
+            "<resources>\n"
+            "  PKG1  svn://svn.example.net/repos/pkg1/trunk\n"
+            "  <resources>\n"
+            "    pkg2  svn://svn.example.net/repos/proj/trunk/src/pkg2\n"
+            "  </resources>\n"
+            "</resources>\n")
+        f.close()
+        where = os.path.dirname(path)
+        whereurl = urlutils.file_url(where)
+        try:
+            self.assertRaises(cfgparser.ConfigurationError,
+                              cf.loadPath, path)
+        finally:
+            os.unlink(path)
+
     def load_text(self, text, path=None, basedir=None):
         if path is None:
             if basedir is None:

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.