Permalink
Browse files

Fixed Wordpress import when importing WXR files above version 1.1.

Also handle all-in-one WXR files by importing only pages and posts.
  • Loading branch information...
1 parent 72b4a96 commit 243aa0763af382c42b4ef9c296473e1fbf824757 @geekman geekman committed Nov 4, 2013
Showing with 6 additions and 3 deletions.
  1. +6 −3 acrylamid/tasks/imprt.py
View
@@ -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 243aa07

Please sign in to comment.