Reverting my previous commit.

Something went horribly wrong when I was doing `hg rebase`.
This commit is contained in:
Yury Selivanov 2015-05-30 10:57:56 -04:00
parent 802d45b660
commit 7aa5341164
19 changed files with 787 additions and 1101 deletions

View file

@ -112,7 +112,10 @@ class Template(metaclass=_TemplateMetaclass):
# Check the most common path first.
named = mo.group('named') or mo.group('braced')
if named is not None:
return str(mapping[named])
val = mapping[named]
# We use this idiom instead of str() because the latter will
# fail if val is a Unicode containing non-ASCII characters.
return '%s' % (val,)
if mo.group('escaped') is not None:
return self.delimiter
if mo.group('invalid') is not None:
@ -139,7 +142,9 @@ class Template(metaclass=_TemplateMetaclass):
named = mo.group('named') or mo.group('braced')
if named is not None:
try:
return str(mapping[named])
# We use this idiom instead of str() because the latter
# will fail if val is a Unicode containing non-ASCII
return '%s' % (mapping[named],)
except KeyError:
return mo.group()
if mo.group('escaped') is not None: