removed duplicated function convert_entity from scrapy.utils.misc

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40269
This commit is contained in:
samus_ 2008-09-23 20:36:32 +00:00
parent 4842fe0679
commit dbfc6341c2
1 changed files with 0 additions and 18 deletions

View File

@ -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: