From 65025d7dcdc1495141bb98cf6498a3a1a1975689 Mon Sep 17 00:00:00 2001 From: Matthew Williams Date: Tue, 27 Mar 2012 09:10:51 -0700 Subject: [PATCH] resetting template.. previous commit not needed --- template | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/template b/template index 68e967ffe93..110d397aa1b 100755 --- a/template +++ b/template @@ -19,7 +19,6 @@ import sys import os -import collections import jinja2 import shlex try: @@ -27,21 +26,6 @@ try: except ImportError: import simplejson as json -environment = jinja2.Environment() - -def format_advanced(fmt, data): - # jinja2 filter to use advanced python string formatting - # e.g, {{ "{0} {1} {2}"|format_advanced(['a', 'b', 'c']) }} - # see http://docs.python.org/library/string.html#formatstrings - if isinstance(data, collections.Mapping): - return fmt.format(**data) - elif isinstance(data, collections.Sequence): - return fmt.format(*data) - else: - return data - -environment.filters['format_advanced'] = format_advanced - # =========================================== # convert arguments of form a=b c=d # to a dictionary @@ -107,7 +91,7 @@ if os.path.exists(dest): md5sum = os.popen("md5sum %s" % dest).read().split()[0] # call Jinja2 here and save the new template file -template = environment.from_string(source) +template = jinja2.Template(source) data_out = template.render(data) f = open(dest, "w+") f.write(data_out)