Skip to content
Browse files

Merge pull request #187 from geekman/master

Fixed Wordpress import when importing WXR files above version 1.1.
  • Loading branch information...
2 parents 72b4a96 + 243aa07 commit e2b81aa05486db46442d5d5e0ea7222a6194fada @posativ committed Nov 6, 2013
Showing with 6 additions and 3 deletions.
  1. +6 −3 acrylamid/tasks/imprt.py
View
9 acrylamid/tasks/imprt.py
@@ -252,8 +252,8 @@ def generate(item):
'tags': [tag.text for tag in item.findall('category')]
}
- if item.find('%spost_type' % wpns).text == 'page':
- entry['type'] = 'page'
+ # attachment, nav_menu_item, page, post
+ entry['type'] = item.find('%spost_type' % wpns).text
if item.find('%sstatus' % wpns).text != 'publish':
entry['draft'] = True
@@ -276,7 +276,10 @@ def generate(item):
for version in range(1, 10):
wpns = '{http://wordpress.org/export/1.%i/}' % version
- return defaults, list(map(generate, tree.findall('channel/item')))
+ if tree.find('channel/%swxr_version' % wpns) is None:
+ continue
+ entries = list(map(generate, tree.findall('channel/item')))
+ return defaults, [entry for entry in entries if entry['type'] in ('page', 'post')]
def fetch(url, auth=None):

0 comments on commit e2b81aa

Please sign in to comment.
Something went wrong with that request. Please try again.