Commit 211bd4d7 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

Fix basic templating to escape $$

parent adb93971
......@@ -42,22 +42,15 @@ class Recipe(object):
hidden_option = '__template_content_%s__' % name
inputfile = open(path, 'r')
try:
# Using internal buildout templating system
options._cooked[hidden_option] = inputfile.read()
self.output_content = options[hidden_option]
finally:
inputfile.close()
with open(path) as inputfile:
self.output_content = '$'.join(options._sub(s, None)
for s in inputfile.read().split('$$'))
self.output_filename = options['output']
def install(self):
outputfile = open(self.output_filename, 'w')
try:
with open(self.output_filename, 'w') as outputfile:
outputfile.write(self.output_content)
finally:
outputfile.close()
if self.mode is not None:
os.chmod(self.output_filename, self.mode)
......
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