[Checkins] SVN: zc.buildout/trunk/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.

Martijn Pieters mj at zopatista.com
Tue Feb 12 04:03:41 EST 2008


Log message for revision 83762:
  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/trunk/src/zc/buildout/buildout.py

-=-
Modified: zc.buildout/trunk/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.py	2008-02-12 09:01:43 UTC (rev 83761)
+++ zc.buildout/trunk/src/zc/buildout/buildout.py	2008-02-12 09:03:40 UTC (rev 83762)
@@ -910,7 +910,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