[Zope3-checkins] CVS: Zope3/src/zope/i18n - simpletranslationservice.py:1.6

Fred L. Drake, Jr. fred@zope.com
Fri, 4 Apr 2003 10:47:11 -0500


Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv25457

Modified Files:
	simpletranslationservice.py 
Log Message:
- add hyphen to the set of allowed characters in a replacement name
  (non-leading only)
- add note that NAME_RE must exactly match the one in zope.tal.taldefs
- clean up type check in assertion; remove an unnecessary import


=== Zope3/src/zope/i18n/simpletranslationservice.py 1.5 => 1.6 ===
--- Zope3/src/zope/i18n/simpletranslationservice.py:1.5	Fri Mar 28 19:06:25 2003
+++ Zope3/src/zope/i18n/simpletranslationservice.py	Fri Apr  4 10:47:11 2003
@@ -17,14 +17,16 @@
 """
 
 import re
-from types import DictType
+
 from zope.component import getService
 from zope.i18n.interfaces import ITranslationService
 
 
-# Setting up some regular expressions for finding interpolation variables in
-# the text.
-NAME_RE = r"[a-zA-Z][a-zA-Z0-9_]*"
+# Set up regular expressions for finding interpolation variables in text.
+# NAME_RE must exactly match the expression of the same name in the
+# zope.tal.taldefs module:
+NAME_RE = r"[a-zA-Z][-a-zA-Z0-9_]*"
+
 _interp_regex = re.compile(r'(?<!\$)(\$(?:%(n)s|{%(n)s}))' %({'n': NAME_RE}))
 _get_var_regex = re.compile(r'%(n)s' %({'n': NAME_RE}))
 
@@ -50,7 +52,7 @@
         if messages is None:
             self.messages = {}
         else:
-            assert type(messages) == DictType
+            assert isinstance(messages, dict)
             self.messages = messages