[Zope3-checkins] CVS: Packages/ZConfig - Substitution.py:1.9

Fred L. Drake, Jr. fred@zope.com
Wed, 4 Dec 2002 15:59:45 -0500


Update of /cvs-repository/Packages/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv5636

Modified Files:
	Substitution.py 
Log Message:
Add isname() function to ZConfig.Substitution.

=== Packages/ZConfig/Substitution.py 1.8 => 1.9 ===
--- Packages/ZConfig/Substitution.py:1.8	Tue Dec  3 10:31:17 2002
+++ Packages/ZConfig/Substitution.py	Wed Dec  4 15:59:13 2002
@@ -1,5 +1,10 @@
 """Substitution support for ZConfig values."""
 
+try:
+    False
+except NameError:
+    False = 0
+
 class SubstitutionError(Exception):
     """Base exception for string substitution errors."""
 
@@ -61,6 +66,15 @@
         return L
     else:
         return []
+
+
+def isname(s):
+    """Return True iff s is a valid substitution name."""
+    m = _name_match(s)
+    if m:
+        return m.group() == s
+    else:
+        return False
 
 
 def _interp(accum, rest, section, context):