Merge pull request #2218 from stuaxo/patch-1

Check for 0 dates in pelican-import
This commit is contained in:
Justin Mayer 2017-10-10 07:14:11 -07:00 committed by GitHub
commit 359ffcabb8

View file

@ -160,6 +160,9 @@ def wp2fields(xml, wp_custpost=False):
content = item.find('encoded').string content = item.find('encoded').string
raw_date = item.find('post_date').string raw_date = item.find('post_date').string
if raw_date == u'0000-00-00 00:00:00':
date = None
else:
date_object = time.strptime(raw_date, '%Y-%m-%d %H:%M:%S') date_object = time.strptime(raw_date, '%Y-%m-%d %H:%M:%S')
date = time.strftime('%Y-%m-%d %H:%M', date_object) date = time.strftime('%Y-%m-%d %H:%M', date_object)
author = item.find('creator').string author = item.find('creator').string