[Checkins] SVN: zc.buildout/branches/help-api/src/zc/buildout/buildout.py The 'if not self._valid(ref)' branch is *always* executed because ref still includes the ${} substitution marker around it. Update the _valid regular expression to include the markers, shaving off 4 tests for every substitution.

Godefroid Chapelle gotcha at bubblenet.be
Sun Mar 29 17:16:34 EDT 2009


Log message for revision 98463:
  The 'if not self._valid(ref)' branch is *always* executed because ref still includes the ${} substitution marker around it. Update the _valid regular expression to include the markers, shaving off 4 tests for every substitution.

Changed:
  U   zc.buildout/branches/help-api/src/zc/buildout/buildout.py

-=-
Modified: zc.buildout/branches/help-api/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/branches/help-api/src/zc/buildout/buildout.py	2009-03-29 21:16:27 UTC (rev 98462)
+++ zc.buildout/branches/help-api/src/zc/buildout/buildout.py	2009-03-29 21:16:34 UTC (rev 98463)
@@ -997,7 +997,7 @@
 
     _template_split = re.compile('([$]{[^}]*})').split
     _simple = re.compile('[-a-zA-Z0-9 ._]+$').match
-    _valid = re.compile('[-a-zA-Z0-9 ._]+:[-a-zA-Z0-9 ._]+$').match
+    _valid = re.compile('\${[-a-zA-Z0-9 ._]+:[-a-zA-Z0-9 ._]+}$').match
     def _sub(self, template, seen):
         value = self._template_split(template)
         subs = []



More information about the Checkins mailing list