Author: jbronn Date: 2009-03-29 22:03:37 -0500 (Sun, 29 Mar 2009) New Revision: 10186
Modified: django/trunk/django/utils/text.py Log: Fixed #10655 -- Who uses 5-space indentation anyways? Thanks to Andrew Badr for the ticket & patch. Modified: django/trunk/django/utils/text.py =================================================================== --- django/trunk/django/utils/text.py 2009-03-29 23:40:04 UTC (rev 10185) +++ django/trunk/django/utils/text.py 2009-03-30 03:03:37 UTC (rev 10186) @@ -219,27 +219,27 @@ 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 @@ quote = s[0] return s[1:-1].replace(r'\%s' % quote, quote).replace(r'\\', '\\') unescape_string_literal = allow_lazy(unescape_string_literal) - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---