From 49053e6ddb5241ccf1bf6376bbfcfe7df7e59ac4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 23 Oct 2015 16:09:03 +0200 Subject: Fix https://github.com/pyload/pyload/issues/2099 --- module/plugins/internal/utils.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'module/plugins/internal/utils.py') diff --git a/module/plugins/internal/utils.py b/module/plugins/internal/utils.py index e01baf30f..7382ef03f 100644 --- a/module/plugins/internal/utils.py +++ b/module/plugins/internal/utils.py @@ -14,7 +14,11 @@ import traceback import urllib import urlparse -import HTMLParser +try: + import HTMLParser + +except ImportError: #@TODO: Remove in 0.4.10 + import xml.sax.saxutils try: import simplejson as json @@ -26,7 +30,7 @@ except ImportError: class utils(object): __name__ = "utils" __type__ = "plugin" - __version__ = "0.07" + __version__ = "0.08" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -107,8 +111,12 @@ def html_unescape(text): """ Removes HTML or XML character references and entities from a text string """ - h = HTMLParser.HTMLParser() - return h.unescape(text) + try: + h = HTMLParser.HTMLParser() + return h.unescape(text) + + except Exception: #@TODO: Remove in 0.4.10 + return xml.sax.saxutils.unescape(text) def isiterable(obj): -- cgit v1.2.3