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

Small fix for post-login redirect #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danfairs
Copy link

Don't break if there's no redirect URL in the callback, but there is a session with no redirect_url in it.

This happens if you've got sessions configured, and you link to the facebook_login view without providing a ?next= querystring parameter.

@bjornlilja
Copy link

We have the same problem, this fix would be great.

Traceback (most recent call last):

File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 117, in get_response
response = middleware_method(request, e)

File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, _callback_args, *_callback_kwargs)

File "/usr/local/lib/python2.6/dist-packages/la_facebook/views.py", line 54, in facebook_callback
return access.callback(request, access, auth_token)

File "/usr/local/lib/python2.6/dist-packages/la_facebook/callbacks/base.py", line 46, in call
redirect_to = self.redirect_url(request)

File "/usr/local/lib/python2.6/dist-packages/la_facebook/callbacks/base.py", line 76, in redirect_url
netloc = urlparse.urlparse(redirect_to)[1]

File "/usr/lib/python2.6/urlparse.py", line 129, in urlparse
tuple = urlsplit(url, scheme, allow_fragments)

File "/usr/lib/python2.6/urlparse.py", line 168, in urlsplit
i = url.find(':')

AttributeError: 'NoneType' object has no attribute 'find'

@mmansour
Copy link

mmansour commented Sep 8, 2011

I had the same problem and applied this fix.
Thanks!

@EmilStenstrom
Copy link

Please apply this pull request. We've run it in production for august, with no issues. It's a little annoying to have to reference a personal git account instead of an official release.

  1. Apply this request
  2. Make a fresh release on PyPi

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

Successfully merging this pull request may close these issues.

None yet

4 participants