* ietf/tests.py: Remove filetime() again -- not using it.
* ietf/utils/soup2text.py: Do line ending normalization. - Legacy-Id: 315
This commit is contained in:
parent
9a9f375ec3
commit
8e8c3ff5e2
|
@ -76,12 +76,6 @@ def filetext(filename):
|
|||
file.close()
|
||||
return chunk
|
||||
|
||||
def filetime(name):
|
||||
if os.path.exists(name):
|
||||
return os.stat(name)[stat.ST_MTIME]
|
||||
else:
|
||||
return 0
|
||||
|
||||
class UrlTestCase(TestCase):
|
||||
def setUp(self):
|
||||
from django.test.client import Client
|
||||
|
|
|
@ -98,8 +98,10 @@ class TextSoup(BeautifulSoup):
|
|||
return str
|
||||
|
||||
def soup2text(html):
|
||||
# Line ending normalization
|
||||
html = html.replace("\r\n", "\n").replace("\r", "\n")
|
||||
# some preprocessing to handle common pathological cases
|
||||
html = re.sub("<br */?>[ \t\r\n]*(<br */?>)+", "<p/>", html)
|
||||
html = re.sub("<br */?>[ \t\n]*(<br */?>)+", "<p/>", html)
|
||||
soup = TextSoup(html)
|
||||
return str(soup)
|
||||
|
||||
|
|
Loading…
Reference in a new issue