Ask Your Question
2

auth-related outbound email not working (NoneType object has no attribute 'get_text')

asked 2013-05-24 11:46:50 -0500

kporangehat gravatar image

updated 2013-05-24 14:37:35 -0500

Running askbot-devel from github and django 1.4.5.

I've configured SMTP info in settings.py and tested my smtp server manually, with the feedback link in askbot and with answer notifications and they seem to work fine.

However, when I sign up a new account or request an account recovery password, I don't get an email and I just see the following in the logs which isn't very helpful or much to go on:

  [Fri May 24 11:16:18 2013] [error] 'NoneType' object has no attribute 'get_text'

That's it. No stack trace and nothing before or after it.

The only get_text I found using grep was in mail/__init__.py clean_html_email():

phrases = map(
    lambda s: s.strip(),
    filter(filter_func, body_element.get_text().split('\n'))
)

Commenting that out didn't work, having DEBUG=True didn't give me any more to go on either. No error occurs in the browser, only in the log, and only that one line.

Update:

I've narrowed it down to deps.django_authopenid.views.send_email_key(). When I run this in the shell I get the same error.

askbot.deps.django_authopenid.views.send_email_key('myemail@example.com', '12345')

/home/ec2-user/.virtualenvs/askbot/lib/python2.6/site-packages/coffin/common.py:73: UserWarning: Cannot translate loader: askbot.skins.loaders.Loader
  warnings.warn('Cannot translate loader: %s' % loader)

'NoneType' object has no attribute 'get_text'

I also tested on the current askbot.org site to try and send a password reset and never got any email so it seems to be broken? Does anyone else have this working?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
2

answered 2013-06-12 23:01:50 -0500

ngkabra gravatar image

I had the same problem. It was occurring with BeautifulSoup-4.2.0. I downgraded to BeautifulSoup-4.1.3 (pip install beautifulsoup4==4.1.3) and the problem has gone away. Obviously, this is a temporary solution, but at least I've gotten things to work.

The real problem has to be some quirk in the HTML that is being generated for the email body - when I have a little time, I'll investigate further, and if I find anything useful, I'll post an update.

edit flag offensive delete link more

Comments

Thanks for posting this. Unfortunately version compatibility of libraries can be tricky.

Evgeny gravatar imageEvgeny ( 2013-06-12 23:41:25 -0500 )edit

I confirmed that downgrading beautifulsoup4 to version 4.1.3 has resolved this issue. Thanks @ngkabra. I'm going to play around a bit to see if I can figure out where the root cause actually lie and will update if I find anything.

kporangehat gravatar imagekporangehat ( 2013-06-14 13:15:53 -0500 )edit

Maybe the incoming HTML does not have the body tag and the new version does stricter parsing?

Evgeny gravatar imageEvgeny ( 2013-06-14 13:56:37 -0500 )edit
1

This looks like it was a bug in beautifulsoup4 v4.2.0. I was able to narrow it down to the ampersands used in the title and headline blocks in templates/authopenid/email_validation.html

...
{% block title %}{% trans %}Greetings from the Q&A forum{% endtrans %},{%endblock%}
{% block headline%}{% trans %}Greetings from the Q&A forum{% endtrans %},{%endblock%}
...

Removing those solved the issue. I also noticed that they released v4.2.1 recently which also resolves the issue. Looks like it may have been this bug: https://bugs.launchpad.net/beautifulsoup/+bug/1182183

All is well now. Thanks everyone for your help and input!

(the 'amp' entities in the code block above got converted. But basically in the template there are literal ampersands)

kporangehat gravatar imagekporangehat ( 2013-06-14 14:31:46 -0500 )edit
0

answered 2013-05-25 00:33:39 -0500

Evgeny gravatar image

Cannot reproduce this issue in the git repo.

Please change DEBUG setting in the settings.py to True, that might help.

edit flag offensive delete link more

Comments

I tried DEBUG=True but that didn't change the output. The error is being shown in log/error_log not log/askbot.log.

As far as reproducing... I don't get an email from this site when I try and recover my password. Maybe that could suffice? Not sure where else to look.

kporangehat gravatar imagekporangehat ( 2013-05-25 10:30:11 -0500 )edit
0

answered 2013-06-13 09:51:05 -0500

pajju gravatar image

updated 2013-06-13 09:54:27 -0500

Looks like your BaseURL is empty or changed, that's why you are not getting email for —New account sign-ups or in requesting an account recovery password.

You need to fill your — "Base URL for your Q&A forum, must start with http or https" setting, goto the Page:

yourdomain.com/settings/QA_SITE_SETTINGS/ that's why your domain and protocol does not shows up.

edit flag offensive delete link more

Comments

I already have that field filled in with a FQDN http://askbot.mydomain.com. Still get the error. I haven't yet tried downgrading beautifulsoup yet as suggested by @ngkabra but will do that today and report back.

kporangehat gravatar imagekporangehat ( 2013-06-13 10:36:06 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-24 11:46:50 -0500

Seen: 1,006 times

Last updated: Jun 13 '13