Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp2zinnia fails on comments #93

Closed
gnitr opened this issue Jun 21, 2011 · 11 comments
Closed

wp2zinnia fails on comments #93

gnitr opened this issue Jun 21, 2011 · 11 comments

Comments

@gnitr
Copy link

gnitr commented Jun 21, 2011

When I try to import a Wordpress XML (1.1) with wp2xinnia, import_comments() crashes while trying to read the comment_type.

'''
Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "c:\src\projects\goughmap\env\dj1.2\lib\site-packages\django\core\management__init__.py", line 438, in execute_manager
utility.execute()
File "c:\src\projects\goughmap\env\dj1.2\lib\site-packages\django\core\management__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\src\projects\goughmap\env\dj1.2\lib\site-packages\django\core\management\base.py", line 191, in run_from_argv
self.execute(_args, *_options.dict)
File "c:\src\projects\goughmap\env\dj1.2\lib\site-packages\django\core\management\base.py", line 220, in execute
output = self.handle(_args, *_options)
File "c:\src\projects\goughmap\env\dj1.2\lib\site-packages\django\core\management\base.py", line 322, in handle
label_output = self.handle_label(label, **options)
File "c:\src\projects\goughmap\env\dj1.2\lib\site-packages\django_blog_zinnia-0.9.dev-py2.7.egg\zinnia\management\commands\wp2
zinnia.py", line 95, in handle_label
self.import_entries(tree.findall('channel/item'))
File "c:\src\projects\goughmap\env\dj1.2\lib\site-packages\django_blog_zinnia-0.9.dev-py2.7.egg\zinnia\management\commands\wp2
zinnia.py", line 279, in import_entries
'{%s}comment/' % WP_NS))
File "c:\src\projects\goughmap\env\dj1.2\lib\site-packages\django_blog_zinnia-0.9.dev-py2.7.egg\zinnia\management\commands\wp2
zinnia.py", line 291, in import_comments
'{%s}comment_type' % WP_NS).text == 'pingback'
AttributeError: 'NoneType' object has no attribute 'text'
'''

I have zinnia 0.9 installed.

The problem seems to be that comment_nodes is the list of all the elements under a particular comment rather than the list of all comments under the item. This explains why comment_type is not found as it tries to find it under wp:comment_id.

@gnitr
Copy link
Author

gnitr commented Jun 21, 2011

Hi,

I fixed this issue by removing the trailing slash in the various find and findall calls near the end of wp2zinnia.py.

In the latest version (accessed 21/06/2011) the affected lines are:
278 -> '{%s}comment' % WP_NS))
293 -> '{%s}comment_id' % WP_NS).text)
297 -> '{%s}comment_content' % WP_NS).text
319 -> '{%s}comment_author' % WP_NS).text[:50],
321 -> '{%s}comment_author_email' % WP_NS).text or '',
323 -> '{%s}comment_author_url' % WP_NS).text or '',
327 -> '{%s}comment_author_IP' % WP_NS).text or '',

@Fantomas42
Copy link
Owner

Hi goffer-looney,

thank you for your report and your solution.

Can you provide me in private your wxr file for reproducing the issue in my sandbox, for establishing a complete patch ?

Regards

@gnitr
Copy link
Author

gnitr commented Jul 7, 2011

Hi Fantomas42,

Thanks for looking into this issue.

I'm new to github, how can I access your sandbox?

Best,

GL

@Fantomas42
Copy link
Owner

Hi,

when I talk about my sandbox, it's about my development environment. :)

You can send me your file by email, at the e-mail adresse indicated on my profile, or upload your file somewhere on the web and provide me the url in PM.

Regards

@Fantomas42
Copy link
Owner

Cannot reproduce the issue due to missing datas

@benoitg
Copy link
Contributor

benoitg commented Sep 5, 2012

Missing data sent by email.

@Fantomas42
Copy link
Owner

Thanks, the datas works fine with the current master version of Zinnia.

@benoitg could you confirm it ?

@mcepl
Copy link
Contributor

mcepl commented Dec 31, 2012

Can reproduce with 0.12dev (the current from pypi). Export file sent via email. Please reopen.

@Fantomas42
Copy link
Owner

Cannot reproduce with the file sent for the moment.

@Fantomas42
Copy link
Owner

The bug is reproduced on Python 2.7.

A fix will come soon.

@mcepl
Copy link
Contributor

mcepl commented Jan 13, 2013

This seems to be really fixed ... I have been able to import my Wordpress site with the script. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants