diff options
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/translation/trans_real.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 8a2527022d..e05b5613a5 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -534,7 +534,6 @@ block_re = re.compile(r"""^\s*blocktrans(\s+.*context\s+((?:"[^"]*?")|(?:'[^']*? endblock_re = re.compile(r"""^\s*endblocktrans$""") plural_re = re.compile(r"""^\s*plural$""") constant_re = re.compile(r"""_\(((?:".*?")|(?:'.*?'))\)""") -one_percent_re = re.compile(r"""(?<!%)%(?!%)""") def templatize(src, origin=None): @@ -631,7 +630,7 @@ def templatize(src, origin=None): else: singular.append('%%(%s)s' % t.contents) elif t.token_type == TOKEN_TEXT: - contents = one_percent_re.sub('%%', t.contents) + contents = t.contents.replace('%', '%%') if inplural: plural.append(contents) else: @@ -667,7 +666,7 @@ def templatize(src, origin=None): g = g.strip('"') elif g[0] == "'": g = g.strip("'") - g = one_percent_re.sub('%%', g) + g = g.replace('%', '%%') if imatch.group(2): # A context is provided context_match = context_re.match(imatch.group(2)) |
