Commit 8025298f by Chris Jerdonek

Fixed partials to indent before rendering.

parent 18d62861
......@@ -399,10 +399,6 @@ class Template(object):
def get_partial(self, name):
pass
def _render_partial(self, name, context):
template = self.get_partial(name)
return self.render_template(template, context)
def _get_string_value(self, context, tag_name):
"""
Get a value from the given context as a basestring instance.
......@@ -454,7 +450,9 @@ class Template(object):
def partial_tag_function(self, name, indentation=''):
def func(context):
nonblank = re.compile(r'^(.)', re.M)
template = re.sub(nonblank, indentation + r'\1', self._render_partial(name, context))
template = self.get_partial(name)
# Indent before rendering.
template = re.sub(nonblank, indentation + r'\1', template)
return self.render_template(template, context)
return func
......
......@@ -55,7 +55,11 @@ def buildTest(testData, spec_filename):
Template: \"""%s\"""
Expected: %s
Actual: %s""" % (description, template, repr(expected), repr(actual))
Actual: %s
Expected: \"""%s\"""
Actual: \"""%s\"""
""" % (description, template, repr(expected), repr(actual), expected, actual)
self.assertEquals(actual, expected, message)
......
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