forked from github/pelican
Merge pull request #2218 from stuaxo/patch-1
Check for 0 dates in pelican-import
This commit is contained in:
commit
359ffcabb8
1 changed files with 5 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue