1
0
Fork 0
forked from github/pelican

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,8 +160,11 @@ def wp2fields(xml, wp_custpost=False):
content = item.find('encoded').string
raw_date = item.find('post_date').string
date_object = time.strptime(raw_date, '%Y-%m-%d %H:%M:%S')
date = time.strftime('%Y-%m-%d %H:%M', date_object)
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 = time.strftime('%Y-%m-%d %H:%M', date_object)
author = item.find('creator').string
categories = [cat.string for cat