From 8c953b07b78314ca321c59f9f0ad65b43bb3204e Mon Sep 17 00:00:00 2001 From: "O1.4" Date: Sun, 9 Feb 2014 15:43:07 +0800 Subject: [PATCH] slugify filename to prevent SimpleHTTPServer raise "file not found" error when import from wp xml. change "lxml" to ["lxml","xml"] for bs4 bug on Windows. --- pelican/tools/pelican_import.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 940849d8..630fc675 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -112,7 +112,7 @@ def get_items(xml): sys.exit(error) with open(xml, encoding='utf-8') as infile: xmlfile = infile.read() - soup = BeautifulSoup(xmlfile, "lxml") + soup = BeautifulSoup(xmlfile, ["lxml", "xml"]) items = soup.rss.channel.findAll('item') return items @@ -167,7 +167,7 @@ def wp2fields(xml, wp_custpost=False): pass else: kind = post_type - yield (title, content, filename, date, author, categories, tags, + yield (title, content, slugify(filename), date, author, categories, tags, kind, "wp-html") def dc2fields(file):