Comments (1)
It should be even bit more complicated to fulfill conditions from protocol.
def normal_dict(request):
"""
Converts a django request arguments (MultiValueDict request.GET, request.POST) into a standard python dict
whose values are the last value from each of the MultiValueDict's value lists. This avoids the OpenID library's
refusal to deal with dicts whose values are lists, because in OpenID, each key in the query arg set can have at most one value.
Also converts keys from unicode to string, so they can be used as arguments in functions.
If request method is POST silently throw out OpenID-like arguments from GET see
U{http://openid.net/specs/openid-authentication-2_0.html#rfc.section.4.1.2}
@param request: Django request object
@type request: C{django.http.HttpRequest}
@return: Dictionary with request arguments
@rtype: C{dict}
"""
if request.method == 'POST':
normal = {}
#take GET first, override them with POST
for key, value in request.GET.items():
#all openid arguments must be in POST
try:
prefix, rest = key.split('.', 1)
if prefix != 'openid':
normal[str(key)] = value
except ValueError: #no prefix
normal[str(key)] = value
for key, value in request.POST.items():
normal[str(key)] = value
return normal
else:
#if not POST, all arguments are GET
normal = {}
for key, value in request.GET.items():
normal[str(key)] = value
return normal
from python-openid.
Related Issues (20)
- The example consumer/ server only ever responds with "OpenID transaction in progress" HOT 1
- Proposing a PR to fix a few small typos HOT 1
- Failure with python 3.9 HOT 1
- "Discovery verification failure" - claimed_id and identity inconsistency for the same account HOT 1
- test_parsehtml.py now fails test runTest HOT 2
- Getting unsigned ax attributes from an openid provider causes a "NoneType object has no attribute get" error HOT 2
- dead project? HOT 35
- What python versions are supported? HOT 1
- When Consumer site sends a redirect, the Auto-Submit stops HOT 1
- Yadis XRDS parser vulnerable to various XML DoS attacks HOT 2
- Vulnerable to man-in-the-middle attacks when not using pycurl HOT 1
- MySQLStore.createTables fails if MySQL’s default character set is utf8mb4 HOT 1
- WSGI examples HOT 1
- When a openid consumer is passed a url that redirects to a relative url we get a DiscoveryFailure
- Will not work over a proxy HOT 1
- wheels for python-openid HOT 1
- IOError Broken Pipe on log HOT 1
- Add support for memcache / memcached persistent storage HOT 1
- Travis CI needs reactivating HOT 1
- Deprecation warning due to invalid escape sequences in Python 3.8 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-openid.