From 6809449e31f37023f3f8cbf1321dbfec1f2bf0a2 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 23 Jul 2012 15:06:49 +0200 Subject: [PATCH] Minor style update --- lib/core/convert.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/core/convert.py b/lib/core/convert.py index 234144714..fa8b6ebd9 100644 --- a/lib/core/convert.py +++ b/lib/core/convert.py @@ -136,13 +136,13 @@ def utf8decode(value): return value.decode("utf-8") def htmlescape(value): - _ = (('&', '&'), ('<', '<'), ('>', '>'), ('"', '"'), ("'", '''), (' ', ' ')) - return reduce(lambda x, y: x.replace(y[0], y[1]), _, value) + codes = (('&', '&'), ('<', '<'), ('>', '>'), ('"', '"'), ("'", '''), (' ', ' ')) + return reduce(lambda x, y: x.replace(y[0], y[1]), codes, value) def htmlunescape(value): retVal = value if value and isinstance(value, basestring): - _ = (('&', '&'), ('<', '<'), ('>', '>'), ('"', '"'), (' ', ' ')) - retVal = reduce(lambda x, y: x.replace(y[0], y[1]), _, retVal) - retVal = re.sub('&#(\d+);', lambda x: unichr(int(x.group(1))), retVal) + codes = (('<', '<'), ('>', '>'), ('"', '"'), (' ', ' '), ('&', '&')) + retVal = reduce(lambda x, y: x.replace(y[0], y[1]), codes, retVal) + retVal = re.sub('&#(\d+);', lambda x: getUnicode(chr(x.group(1))), retVal) return retVal