Permalink
Browse files

Back out 6485d8c.

The actualy Django version expected by the example code looks to be 0.96.1.
  • Loading branch information...
tseaver committed Mar 29, 2012
1 parent 6485d8c commit 421f53d689eef3a8fcfd7dd83f459a5db2713f57
Showing with 46 additions and 34 deletions.
  1. +4 −4 examples/djopenid/consumer/views.py
  2. +36 −24 examples/djopenid/server/views.py
  3. +6 −6 examples/djopenid/views.py
@@ -38,8 +38,8 @@ def renderIndexPage(request, **template_args):
template_args['consumer_url'] = util.getViewURL(request, startOpenID)
template_args['pape_policies'] = POLICY_PAIRS
- response = direct_to_template(request, 'consumer/index.html',
- **template_args)
+ response = direct_to_template(
+ request, 'consumer/index.html', template_args)
response[YADIS_HEADER_NAME] = util.getViewURL(request, rpXRDS)
return response
@@ -128,8 +128,8 @@ def startOpenID(request):
form_id = 'openid_message'
form_html = auth_request.formMarkup(trust_root, return_to,
False, {'id': form_id})
- return direct_to_template(request, 'consumer/request_form.html',
- html=form_html)
+ return direct_to_template(
+ request, 'consumer/request_form.html', {'html': form_html})
return renderIndexPage(request)
@@ -23,7 +23,8 @@
from django import http
from django.views.generic.simple import direct_to_template
-from openid.server.server import Server, ProtocolError, EncodingError
+from openid.server.server import Server, ProtocolError, CheckIDRequest, \
+ EncodingError
from openid.server.trustroot import verifyReturnTo
from openid.yadis.discover import DiscoveryFailure
from openid.consumer.discover import OPENID_IDP_2_0_TYPE
@@ -63,10 +64,12 @@ def server(request):
"""
Respond to requests for the server's primary web page.
"""
- return direct_to_template(request, 'server/index.html',
- user_url=getViewURL(request, idPage),
- server_xrds_url=getViewURL(request, idpXrds),
- )
+ return direct_to_template(
+ request,
+ 'server/index.html',
+ {'user_url': getViewURL(request, idPage),
+ 'server_xrds_url': getViewURL(request, idpXrds),
+ })
def idpXrds(request):
"""
@@ -80,19 +83,20 @@ def idPage(request):
"""
Serve the identity page for OpenID URLs.
"""
- return direct_to_template(request, 'server/idPage.html',
- server_url=getViewURL(request, endpoint),
- )
+ return direct_to_template(
+ request,
+ 'server/idPage.html',
+ {'server_url': getViewURL(request, endpoint)})
def trustPage(request):
"""
Display the trust page template, which allows the user to decide
whether to approve the OpenID verification.
"""
- return direct_to_template(request, 'server/trust.html',
- trust_handler_url=getViewURL(request,
- processTrustResult),
- )
+ return direct_to_template(
+ request,
+ 'server/trust.html',
+ {'trust_handler_url':getViewURL(request, processTrustResult)})
def endpoint(request):
"""
@@ -108,13 +112,18 @@ def endpoint(request):
openid_request = s.decodeRequest(query)
except ProtocolError, why:
# This means the incoming request was invalid.
- return direct_to_template(request, 'server/endpoint.html',
- error=str(why))
+ return direct_to_template(
+ request,
+ 'server/endpoint.html',
+ {'error': str(why)})
# If we did not get a request, display text indicating that this
# is an endpoint.
if openid_request is None:
- return direct_to_template(request, 'server/endpoint.html')
+ return direct_to_template(
+ request,
+ 'server/endpoint.html',
+ {})
# We got a request; if the mode is checkid_*, we will handle it by
# getting feedback from the user or by checking the session.
@@ -187,13 +196,14 @@ def showDecidePage(request, openid_request):
pape_request = pape.Request.fromOpenIDRequest(openid_request)
- return direct_to_template(request, 'server/trust.html',
- trust_root=trust_root,
- trust_handler_url=getViewURL(request,
- processTrustResult),
- trust_root_valid=trust_root_valid,
- pape_request=pape_request,
- )
+ return direct_to_template(
+ request,
+ 'server/trust.html',
+ {'trust_root': trust_root,
+ 'trust_handler_url':getViewURL(request, processTrustResult),
+ 'trust_root_valid': trust_root_valid,
+ 'pape_request': pape_request,
+ })
def processTrustResult(request):
"""
@@ -254,8 +264,10 @@ def displayResponse(request, openid_response):
except EncodingError, why:
# If it couldn't be encoded, display an error.
text = why.response.encodeToKVForm()
- return direct_to_template(request, 'server/endpoint.html',
- error=cgi.escape(text))
+ return direct_to_template(
+ request,
+ 'server/endpoint.html',
+ {'error': cgi.escape(text)})
# Construct the appropriate django framework response.
r = http.HttpResponse(webresponse.body)
View
@@ -3,12 +3,12 @@
from django.views.generic.simple import direct_to_template
def index(request):
- consumer_url = util.getViewURL(request,
- 'djopenid.consumer.views.startOpenID')
+ consumer_url = util.getViewURL(
+ request, 'djopenid.consumer.views.startOpenID')
server_url = util.getViewURL(request, 'djopenid.server.views.server')
- return direct_to_template(request, 'index.html',
- consumer_url=consumer_url,
- server_url=server_url,
- )
+ return direct_to_template(
+ request,
+ 'index.html',
+ {'consumer_url':consumer_url, 'server_url':server_url})

0 comments on commit 421f53d

Please sign in to comment.