Commit ef1a217b authored by Romain Courteaud's avatar Romain Courteaud

Escape $$ character to $.

Do not escape when fetching dependency values.
parent 8232c9aa
...@@ -1146,6 +1146,7 @@ class Options(UserDict.DictMixin): ...@@ -1146,6 +1146,7 @@ class Options(UserDict.DictMixin):
self._raw = data self._raw = data
self._cooked = {} self._cooked = {}
self._data = {} self._data = {}
self._non_escaped_data = {}
def _initialize(self): def _initialize(self):
name = self.name name = self.name
...@@ -1207,11 +1208,17 @@ class Options(UserDict.DictMixin): ...@@ -1207,11 +1208,17 @@ class Options(UserDict.DictMixin):
v = '$$'.join([self._sub(s, seen) for s in v.split('$$')]) v = '$$'.join([self._sub(s, seen) for s in v.split('$$')])
self._cooked[option] = v self._cooked[option] = v
def get(self, option, default=None, seen=None): def get(self, option, default=None, seen=None, escaped=True):
try: if escaped:
return self._data[option] try:
except KeyError: return self._data[option]
pass except KeyError:
pass
else:
try:
return self._non_escaped_data[option]
except KeyError:
pass
v = self._cooked.get(option) v = self._cooked.get(option)
if v is None: if v is None:
...@@ -1234,8 +1241,13 @@ class Options(UserDict.DictMixin): ...@@ -1234,8 +1241,13 @@ class Options(UserDict.DictMixin):
v = '$$'.join([self._sub(s, seen) for s in v.split('$$')]) v = '$$'.join([self._sub(s, seen) for s in v.split('$$')])
seen.pop() seen.pop()
self._non_escaped_data[option] = v
v = v.replace('$${', '${')
self._data[option] = v self._data[option] = v
return v if escaped:
return self._data[option]
else:
return self._non_escaped_data[option]
_template_split = re.compile('([$]{[^}]*})').split _template_split = re.compile('([$]{[^}]*})').split
_simple = re.compile('[-a-zA-Z0-9 ._]+$').match _simple = re.compile('[-a-zA-Z0-9 ._]+$').match
...@@ -1268,7 +1280,8 @@ class Options(UserDict.DictMixin): ...@@ -1268,7 +1280,8 @@ class Options(UserDict.DictMixin):
section, option = s section, option = s
if not section: if not section:
section = self.name section = self.name
v = self.buildout[section].get(option, None, seen) v = self.buildout[section].get(option, None, seen,
escaped=False)
if v is None: if v is None:
if option == '_buildout_section_name_': if option == '_buildout_section_name_':
v = self.name v = self.name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment