You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was getting a HTTP 400 Bad Request when exporting my django.contrib.comments. This was because the export command was not properly assigning the default value when the contrib model returned an empty string for User and User Email.
I fixed it by modifying the disqus_export.py file to perform the following tests:
author_email = '[email protected]' if not author_email else author_email
author_name = 'nobody' if not author_name else author_name
that segment of code then looked like:
# name and email are optional in contrib.comments but required
# in DISQUS. If they are not set, dummy values will be used
author_email = comment.userinfo.get('email', '')
author_email = '[email protected]' if not author_email else author_email
author_name = comment.userinfo.get('name', '')
author_name = 'nobody' if not author_name else author_name
client.create_post(
forum_api_key=forum_api_key,
thread_id=thread['id'],
message=comment.comment.encode('utf-8'),
author_name=author_name.encode('utf-8'),
author_email=author_email.encode('utf-8'),
author_url=comment.userinfo.get('url', ''),
created_at=comment.submit_date.strftime('%Y-%m-%dT%H:%M'))
if state_file is not None:
self._save_state(state_file, comment.pk)
The text was updated successfully, but these errors were encountered:
This solves this issue partly. I ran into an issue when first exporting from Posterous to Django comments and then to Disqus, cause email is empty (or ''), so email is there but it's empty. So I made an extra check just to make sure it really is there, something like:
I realize this was 3+ years ago, but if you still have the code, it would be SUPER nice to get it in a pull request so we could include it in the next release.
I was getting a HTTP 400 Bad Request when exporting my django.contrib.comments. This was because the export command was not properly assigning the default value when the contrib model returned an empty string for User and User Email.
I fixed it by modifying the disqus_export.py file to perform the following tests:
author_email = '[email protected]' if not author_email else author_email
author_name = 'nobody' if not author_name else author_name
that segment of code then looked like:
The text was updated successfully, but these errors were encountered: