lazy-load beautifulsoup

This commit is contained in:
Damien Elmes 2009-07-10 00:37:06 +09:00
parent 2f2487e5b8
commit b80fc40aee

View file

@ -18,7 +18,6 @@ from xml.dom import minidom, Node
from types import DictType, InstanceType
from string import capwords, maketrans
import re, unicodedata, time
from BeautifulSoup import BeautifulStoneSoup
#import chardet
@ -133,7 +132,7 @@ class SupermemoXmlImporter(Importer):
def _decode_htmlescapes(self,s):
"""Unescape HTML code."""
from BeautifulSoup import BeautifulStoneSoup
#my sm2004 also ecaped & chars in escaped sequences.
s = re.sub(u'&',u'&',s)
return unicode(BeautifulStoneSoup(s,convertEntities=BeautifulStoneSoup.HTML_ENTITIES ))