|
@@ -13,7 +13,12 @@ |
|
|
|
|
|
def wp2fields(xml):
|
|
|
"""Opens a wordpress XML file, and yield pelican fields"""
|
|
|
- from BeautifulSoup import BeautifulStoneSoup
|
|
|
+ try:
|
|
|
+ from BeautifulSoup import BeautifulStoneSoup
|
|
|
+ except ImportError:
|
|
|
+ error = 'Missing dependency ' + \
|
|
|
+ '"BeautifulSoup" required to import Wordpress files.'
|
|
|
+ sys.exit(error)
|
|
|
|
|
|
xmlfile = open(xml, encoding='utf-8').read()
|
|
|
soup = BeautifulStoneSoup(xmlfile)
|
|
@@ -40,7 +45,13 @@ def wp2fields(xml): |
|
|
|
|
|
def dc2fields(file):
|
|
|
"""Opens a Dotclear export file, and yield pelican fields"""
|
|
|
- from BeautifulSoup import BeautifulStoneSoup
|
|
|
+ try:
|
|
|
+ from BeautifulSoup import BeautifulStoneSoup
|
|
|
+ except ImportError:
|
|
|
+ error = 'Missing dependency ' + \
|
|
|
+ '"BeautifulSoup" required to import Dotclear files.'
|
|
|
+ sys.exit(error)
|
|
|
+
|
|
|
|
|
|
in_cat = False
|
|
|
in_post = False
|
|
|
This comment has been minimized.
Show comment Hide commenttshepangApr 18, 2012
nit: 2nd assignment looks better than 1st one
tshepang repliedApr 18, 2012
nit: 2nd assignment looks better than 1st one
This comment has been minimized.
Show comment Hide commentakavlieApr 19, 2012
Owneragreed, adding another commit for that momentarily.
akavlie repliedApr 19, 2012
agreed, adding another commit for that momentarily.