Skip to content

Small fix for post-login redirect#32

Open
danfairs wants to merge 1 commit into
cartwheelweb:masterfrom
danfairs:master
Open

Small fix for post-login redirect#32
danfairs wants to merge 1 commit into
cartwheelweb:masterfrom
danfairs:master

Conversation

@danfairs

Copy link
Copy Markdown

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
Copy Markdown

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

mmansour commented Sep 8, 2011

Copy link
Copy Markdown

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

@EmilStenstrom

Copy link
Copy Markdown

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.

4 participants