diff --git a/blog/management/commands/wordpress_to_wagtail.py b/blog/management/commands/wordpress_to_wagtail.py index ec52f01..d54aa01 100755 --- a/blog/management/commands/wordpress_to_wagtail.py +++ b/blog/management/commands/wordpress_to_wagtail.py @@ -1,4 +1,5 @@ from base64 import b64encode + from datetime import datetime try: import html @@ -339,9 +340,14 @@ def create_blog_pages(self, posts, blog_index, *args, **options): description = post.get('description') if description: description = self.convert_html_entities(description) - body = linebreaks(post.get('content')) + + body = post.get('content') + if not "

" in body: + body = linebreaks(body) + # get image info from content and create image objects body = self.create_images_from_urls_in_content(body) + # author/user data author = post.get('author') user = self.create_user(author) diff --git a/blog/tests.py b/blog/tests.py index 9b5273a..9184f34 100644 --- a/blog/tests.py +++ b/blog/tests.py @@ -209,6 +209,10 @@ def test_import_xml(self): self.assertEqual(child_category.slug, "cheat-sheets") self.assertEqual(parent_category.slug, "marketing-2") + # Assert that

tags were added to the post that didn't contain them + page = BlogPage.objects.filter(slug='asa-releases-2013-economic-analysis-of-staffing-industry-trends').get() + self.assertEqual(page.body, "

The American Staffing Association has released its 2013 economic analysis,\"Navigating the 1% Economy.\" Written by ASA chief operating officer Steven P. Berchem, CSP, the report takes an in-depth look at recent staffing employment trends and what these suggest about the current economic environment and future labor market conditions.

") + def test_import_xml_comments(self): """ diff --git a/example_export.xml b/example_export.xml index 622039b..8900649 100644 --- a/example_export.xml +++ b/example_export.xml @@ -188,7 +188,7 @@ Sorry that not work]]> test@test.test http://blog.blog.com/?post_type=articles&p=521 - The American Staffing Association has released its 2013 economic analysis,"Navigating the 1% Economy." Written by ASA chief operating officer Steven P. Berchem, CSP, the report takes an in-depth look at recent staffing employment trends and what these suggest about the current economic environment and future labor market conditions.

]]>
+ 521 2013-11-19 17:27:33