Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

removed duplicated function convert_entity from scrapy.utils.misc

samus_dbfc6341c255
diff --git a/scrapy/trunk/scrapy/utils/misc.py b/scrapy/trunk/scrapy/utils/misc.py
index 0cd87568f..6f27075e2 100644
--- a/scrapy/trunk/scrapy/utils/misc.py
+++ b/scrapy/trunk/scrapy/utils/misc.py
@@ -2,7 +2,6 @@
Auxiliary functions which doesn't fit anywhere else
"""
import re
-import htmlentitydefs
from twisted.internet import defer, reactor
from twisted.python import failure
@@ -156,23 +155,6 @@ def load_class(class_path):
return cls
-def convert_entity(m, keep_reserved=False):
- """
- Convert a HTML entity into unicode string
- """
- if m.group(1)=='#':
- try:
- return unichr(int(m.group(2)))
- except ValueError:
- return '&#%s;' % m.group(2)
- try:
- if not (keep_reserved and m.group(2) in ['lt', 'amp']):
- return unichr(htmlentitydefs.name2codepoint[m.group(2)])
- else:
- return '&%s;' % m.group(2)
- except KeyError:
- return '&%s;' % m.group(2)
-
def extract_regex(regex, text, encoding):
"""Extract a list of unicode strings from the given text/encoding using the following policies: