Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #10655 -- Who uses 5-space indentation anyways? Thanks to Andre…

…w Badr for the ticket & patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10186 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9b00b87cf2b8a02fdb2595cd0e9bd37d1f7ab32e 1 parent 39ff4c9
@jbronn jbronn authored
Showing with 17 additions and 18 deletions.
  1. +17 −18 django/utils/text.py
View
35 django/utils/text.py
@@ -219,27 +219,27 @@ def smart_split(text):
smart_split = allow_lazy(smart_split, unicode)
def _replace_entity(match):
- text = match.group(1)
- if text[0] == u'#':
- text = text[1:]
- try:
- if text[0] in u'xX':
- c = int(text[1:], 16)
- else:
- c = int(text)
- return unichr(c)
- except ValueError:
- return match.group(0)
- else:
- try:
- return unichr(name2codepoint[text])
- except (ValueError, KeyError):
- return match.group(0)
+ text = match.group(1)
+ if text[0] == u'#':
+ text = text[1:]
+ try:
+ if text[0] in u'xX':
+ c = int(text[1:], 16)
+ else:
+ c = int(text)
+ return unichr(c)
+ except ValueError:
+ return match.group(0)
+ else:
+ try:
+ return unichr(name2codepoint[text])
+ except (ValueError, KeyError):
+ return match.group(0)
_entity_re = re.compile(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));")
def unescape_entities(text):
- return _entity_re.sub(_replace_entity, text)
+ return _entity_re.sub(_replace_entity, text)
unescape_entities = allow_lazy(unescape_entities, unicode)
def unescape_string_literal(s):
@@ -261,4 +261,3 @@ def unescape_string_literal(s):
quote = s[0]
return s[1:-1].replace(r'\%s' % quote, quote).replace(r'\\', '\\')
unescape_string_literal = allow_lazy(unescape_string_literal)
-
Please sign in to comment.
Something went wrong with that request. Please try again.