From 8e8c3ff5e2d79f91fc327859ce8f9a2123aea7d6 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Mon, 11 Jun 2007 17:26:59 +0000 Subject: [PATCH] * ietf/tests.py: Remove filetime() again -- not using it. * ietf/utils/soup2text.py: Do line ending normalization. - Legacy-Id: 315 --- ietf/tests.py | 6 ------ ietf/utils/soup2text.py | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ietf/tests.py b/ietf/tests.py index 84579d348..bc4e866e2 100644 --- a/ietf/tests.py +++ b/ietf/tests.py @@ -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 diff --git a/ietf/utils/soup2text.py b/ietf/utils/soup2text.py index 3e7a50af0..f93de65f3 100755 --- a/ietf/utils/soup2text.py +++ b/ietf/utils/soup2text.py @@ -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("
[ \t\r\n]*(
)+", "

", html) + html = re.sub("
[ \t\n]*(
)+", "

", html) soup = TextSoup(html) return str(soup)