[Checkins] SVN: ZConfig/trunk/ Allow identical redefinition of ``%define`` names.
Tres Seaver
tseaver at palladion.com
Tue Jul 13 16:42:59 EDT 2010
Log message for revision 114722:
Allow identical redefinition of ``%define`` names.
Merges lp:~tseaver/zconfig/allow_identical_redefine .
Changed:
U ZConfig/trunk/NEWS.txt
U ZConfig/trunk/ZConfig/cfgparser.py
U ZConfig/trunk/ZConfig/tests/test_config.py
U ZConfig/trunk/doc/zconfig.tex
-=-
Modified: ZConfig/trunk/NEWS.txt
===================================================================
--- ZConfig/trunk/NEWS.txt 2010-07-13 17:37:54 UTC (rev 114721)
+++ ZConfig/trunk/NEWS.txt 2010-07-13 20:42:58 UTC (rev 114722)
@@ -3,6 +3,12 @@
==========================
+After ZConfig 2.8.0 )unreleased)
+--------------------------------
+
+- Allow identical redefinition of ``%define`` names.
+
+
ZConfig 2.8.0 (2010-04-13)
--------------------------
Modified: ZConfig/trunk/ZConfig/cfgparser.py
===================================================================
--- ZConfig/trunk/ZConfig/cfgparser.py 2010-07-13 17:37:54 UTC (rev 114721)
+++ ZConfig/trunk/ZConfig/cfgparser.py 2010-07-13 20:42:58 UTC (rev 114722)
@@ -160,7 +160,8 @@
if len(parts) == 2:
defvalue = parts[1]
if self.defines.has_key(defname):
- self.error("cannot redefine " + `defname`)
+ if self.defines[defname] != defvalue:
+ self.error("cannot redefine " + `defname`)
if not isname(defname):
self.error("not a substitution legal name: " + `defname`)
self.defines[defname] = self.replace(defvalue)
Modified: ZConfig/trunk/ZConfig/tests/test_config.py
===================================================================
--- ZConfig/trunk/ZConfig/tests/test_config.py 2010-07-13 17:37:54 UTC (rev 114721)
+++ ZConfig/trunk/ZConfig/tests/test_config.py 2010-07-13 20:42:58 UTC (rev 114722)
@@ -133,7 +133,9 @@
self.assertRaises(ZConfig.ConfigurationSyntaxError,
self.loadtext, "%define abc-def\n")
self.assertRaises(ZConfig.ConfigurationSyntaxError,
- self.loadtext, "%define a value\n%define a value\n")
+ self.loadtext, "%define a value\n%define a other\n")
+ # doesn't raise if value is equal
+ self.loadtext("%define a value\n%define a value\n")
def test_fragment_ident_disallowed(self):
self.assertRaises(ZConfig.ConfigurationError,
Modified: ZConfig/trunk/doc/zconfig.tex
===================================================================
--- ZConfig/trunk/doc/zconfig.tex 2010-07-13 17:37:54 UTC (rev 114721)
+++ ZConfig/trunk/doc/zconfig.tex 2010-07-13 20:42:58 UTC (rev 114722)
@@ -272,9 +272,8 @@
pairs.
Names must be defined before they are used, and may not be
-re-defined. All resources being parsed as part of a configuration
-share a single namespace for defined names. This means that resources
-which may be included more than once should not define any names.
+re-defined with a different value. All resources being parsed as part of
+a configuration share a single namespace for defined names.
References to defined names from configuration values use the syntax
described for the \refmodule{ZConfig.substitution} module.
More information about the checkins
mailing list