From 278d5c3db0144350cf9ebfa15e5c7d54d291932b Mon Sep 17 00:00:00 2001 From: Andrew Cassidy Date: Sun, 13 Nov 2011 15:16:16 +0000 Subject: [PATCH] fixed the url names, and the logout function that was recursively calling itself for shits and giggles. --- setup.py | 3 ++- twython_django_oauth/urls.py | 8 ++++---- twython_django_oauth/views.py | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 684391e..2614124 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,8 @@ setup( include_package_data = True, # Package dependencies. - install_requires = ['simplejson', 'oauth2', 'httplib2', 'twython'], + install_requires = ['simplejson', 'oauth2', 'httplib2', 'twython', 'django'], + provides = ['twython_django_oauth'], # Metadata for PyPI. author = 'Ryan McGrath', diff --git a/twython_django_oauth/urls.py b/twython_django_oauth/urls.py index a017d81..27a4164 100644 --- a/twython_django_oauth/urls.py +++ b/twython_django_oauth/urls.py @@ -4,16 +4,16 @@ from django.conf.urls.defaults import * urlpatterns = patterns('twython_django_oauth.views', # First leg of the authentication journey... - (r'^login/?$', "begin_auth", name="twitter_login"), + url(r'^login/?$', "begin_auth", name="twitter_login"), # Logout, if need be - (r'^logout/?$', "logout", name="twitter_logout"), # Calling logout and what not + url(r'^logout/?$', "logout", name="twitter_logout"), # Calling logout and what not # This is where they're redirected to after authorizing - we'll # further (silently) redirect them again here after storing tokens and such. - (r'^thanks/?$', "thanks", name="twitter_callback"), + url(r'^thanks/?$', "thanks", name="twitter_callback"), # An example view using a Twython method with proper OAuth credentials. Clone # this view and url definition to get the rest of your desired pages/functionality. - (r'^user_timeline/?$', "user_timeline", name="twitter_timeline"), + url(r'^user_timeline/?$', "user_timeline", name="twitter_timeline"), ) diff --git a/twython_django_oauth/views.py b/twython_django_oauth/views.py index 155c16f..4f0548a 100644 --- a/twython_django_oauth/views.py +++ b/twython_django_oauth/views.py @@ -1,4 +1,4 @@ -from django.contrib.auth import authenticate, login, logout +from django.contrib.auth import authenticate, login, logout as django_logout from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response @@ -17,8 +17,8 @@ def logout(request, redirect_url=settings.LOGOUT_REDIRECT_URL): Nothing hilariously hidden here, logs a user out. Strip this out if your application already has hooks to handle this. """ - logout(request) - return HttpResponseRedirect(request.build_absolute_uri(reverse(redirect_url))) + django_logout(request) + return HttpResponseRedirect(request.build_absolute_uri(redirect_url)) def begin_auth(request): """