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

Changes to Python 3.4 #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Requirements
============

- `oauth2 <http://pypi.python.org/pypi/oauth2/>`_
- `python-openid <http://pypi.python.org/pypi/python-openid>`_
- `python3-openid <https://pypi.python.org/pypi/python3-openid/3.0.6>`_
- `facebook-python-sdk <https://github.com/facebook/python-sdk>`_

.. note::
Expand Down
6 changes: 3 additions & 3 deletions socialregistration/contrib/openid/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from socialregistration.clients import Client
from socialregistration.contrib.openid.storage import OpenIDStore
from socialregistration.settings import SESSION_KEY
import urlparse
import urllib

class OpenIDClient(Client):
def __init__(self, session_data, endpoint_url):
Expand All @@ -18,7 +18,7 @@ def get_realm(self):
return 'http://%s/' % Site.objects.get_current().domain

def get_callback_url(self, **kwargs):
return urlparse.urljoin(self.get_realm(),
return urllib.parse.urljoin(self.get_realm(),
reverse('socialregistration:openid:callback'))

def get_redirect_url(self):
Expand All @@ -30,7 +30,7 @@ def get_redirect_url(self):
return redirect_url

def complete(self, GET, path):
self.result = self.consumer.complete(GET, urlparse.urljoin(self.get_realm(),
self.result = self.consumer.complete(GET, urllib.parse.urljoin(self.get_realm(),
path))

def is_valid(self):
Expand Down
4 changes: 2 additions & 2 deletions socialregistration/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.views.generic.base import TemplateResponseMixin
from socialregistration import signals
from socialregistration.settings import SESSION_KEY
import urlparse
import urllib

ERROR_VIEW = getattr(settings, 'SOCIALREGISTRATION_ERROR_VIEW_FUNCTION',
None)
Expand Down Expand Up @@ -42,7 +42,7 @@ def get_next(self, request):
else:
next = getattr(settings, 'LOGIN_REDIRECT_URL', '/')

netloc = urlparse.urlparse(next)[1]
netloc = urllib.parse.urlparse(next)[1]

if netloc and netloc != request.get_host():
next = getattr(settings, 'LOGIN_REDIRECT_URL', '/')
Expand Down
5 changes: 2 additions & 3 deletions socialregistration/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import View, TemplateView
from socialregistration.clients.oauth import OAuthError
from socialregistration.contrib.openid.client import OpenIDClient
from socialregistration.mixins import SocialRegistration

Expand Down Expand Up @@ -211,7 +210,7 @@ def post(self, request):
logger.debug("Redirecting to %s", url)
try:
return HttpResponseRedirect(url)
except OAuthError, error:
except error:
return self.error_to_response(request, {'error': error})
except socket.timeout:
return self.error_to_response(request, {'error':
Expand Down Expand Up @@ -258,7 +257,7 @@ def get(self, request):
return HttpResponseRedirect(self.get_redirect())
except KeyError:
return self.error_to_response(request, {'error': "Session expired."})
except OAuthError, error:
except error:
return self.error_to_response(request, {'error': error})
except socket.timeout:
return self.error_to_response(request, {'error':
Expand Down