SVN: zpkgtools/trunk/zpkgtools/ make the <exclude> section conform to the basic expectation that each line

"Fred L. Drake, Jr." <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Log message for revision 38208:
  make the <exclude> section conform to the basic expectation that each line
  is a single package name; the tests did not cover the case of extra junk in
  the "value" portion of the line
  

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

-=-
Modified: zpkgtools/trunk/zpkgtools/config.py
===================================================================
--- zpkgtools/trunk/zpkgtools/config.py	2005-08-31 18:37:06 UTC (rev 38207)
+++ zpkgtools/trunk/zpkgtools/config.py	2005-08-31 18:37:12 UTC (rev 38208)
@@ -28,6 +28,12 @@
 get_schema = cfgparser.cachedSchemaLoader("config.xml")
 
 
+def empty_string(string):
+    if string:
+        raise ValueError("no value can be associated with an exclusion")
+    return string
+
+
 def non_empty_string(string):
     if not string:
         raise ValueError("value cannot be empty")

Modified: zpkgtools/trunk/zpkgtools/config.xml
===================================================================
--- zpkgtools/trunk/zpkgtools/config.xml	2005-08-31 18:37:06 UTC (rev 38207)
+++ zpkgtools/trunk/zpkgtools/config.xml	2005-08-31 18:37:12 UTC (rev 38208)
@@ -39,7 +39,7 @@
                >
     <key name="+"
          attribute="mapping"
-         type=".config.non_empty_string"
+         datatype=".config.empty_string"
          />
   </sectiontype>
 

Modified: zpkgtools/trunk/zpkgtools/tests/test_config.py
===================================================================
--- zpkgtools/trunk/zpkgtools/tests/test_config.py	2005-08-31 18:37:06 UTC (rev 38207)
+++ zpkgtools/trunk/zpkgtools/tests/test_config.py	2005-08-31 18:37:12 UTC (rev 38208)
@@ -154,6 +154,14 @@
         self.assertEqual(cf.exclude_packages,
                          ['reportlab', 'zope.app', 'zpkgsetup'])
 
+    def test_exclude_packages_does_not_allow_value(self):
+        self.assertRaises(
+            cfgparser.ConfigurationError,
+            self.load_text,
+            "<exclude>\n"
+            "  reportlab   unnecessary junk\n"
+            "</exclude>\n")
+
     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.