Transition webob BadRequest|HTTPFound to webob/redirect

More transitioning away from webob
Response import from webob was unused
This commit is contained in:
Sebastian Spaeth 2012-11-16 11:13:01 +01:00
parent 0eff207dff
commit bf3b9e783d

View File

@ -18,7 +18,6 @@
import logging import logging
import json import json
from webob import exc, Response
from urllib import urlencode from urllib import urlencode
from uuid import uuid4 from uuid import uuid4
from datetime import datetime from datetime import datetime
@ -95,7 +94,7 @@ def authorize_client(request):
if not client: if not client:
_log.error('''No such client id as received from client authorization _log.error('''No such client id as received from client authorization
form.''') form.''')
return exc.HTTPBadRequest() return BadRequest()
if form.validate(): if form.validate():
relation = OAuthUserClient() relation = OAuthUserClient()
@ -106,11 +105,11 @@ def authorize_client(request):
elif form.deny.data: elif form.deny.data:
relation.state = u'rejected' relation.state = u'rejected'
else: else:
return exc.HTTPBadRequest return BadRequest
relation.save() relation.save()
return exc.HTTPFound(location=form.next.data) return redirect(request, location=form.next.data)
return render_to_response( return render_to_response(
request, request,
@ -163,7 +162,7 @@ def authorize(request, client):
_log.debug('Redirecting to {0}'.format(redirect_uri)) _log.debug('Redirecting to {0}'.format(redirect_uri))
return exc.HTTPFound(location=redirect_uri) return redirect(request, location=redirect_uri)
else: else:
# Show prompt to allow client to access data # Show prompt to allow client to access data
# - on accept: send the user agent back to the redirect_uri with the # - on accept: send the user agent back to the redirect_uri with the