Modular Changes #2

Merged
zandeez merged 5 commits from master into master 2011-11-16 12:15:32 -08:00
3 changed files with 9 additions and 8 deletions
Showing only changes of commit 278d5c3db0 - Show all commits

View file

@ -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',

View file

@ -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"),
)

View file

@ -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):
"""