[Python-checkins] r80165 - tracker/instances/python-dev/lib/openid.py
martin.v.loewis
python-checkins at python.org
Sun Apr 18 10:41:43 CEST 2010
Author: martin.v.loewis
Date: Sun Apr 18 10:41:43 2010
New Revision: 80165
Log:
PyPI issue #2987103: support application/xhtml+xml
documents for HTML-Based Discovery.
Modified:
tracker/instances/python-dev/lib/openid.py
Modified: tracker/instances/python-dev/lib/openid.py
==============================================================================
--- tracker/instances/python-dev/lib/openid.py (original)
+++ tracker/instances/python-dev/lib/openid.py Sun Apr 18 10:41:43 2010
@@ -182,7 +182,7 @@
if xrds_loc and content_type != 'application/xrds+xml':
return discover(xrds_loc)
- if content_type == 'text/html':
+ if content_type in ('text/html', 'application/xhtml+xml'):
soup = BeautifulSoup.BeautifulSoup(data)
# Yadis 6.2.5 option 1: meta tag
meta = soup.find('meta', {'http-equiv':lambda v:v and v.lower()=='x-xrds-location'})
@@ -212,7 +212,7 @@
# Discovery failed
return None
- if content_type == 'application/xrds+xml':
+ elif content_type == 'application/xrds+xml':
# Yadis 6.2.5 option 4
doc = ElementTree.fromstring(data)
for svc in doc.findall(".//{xri://$xrd*($v*2.0)}Service"):
@@ -248,6 +248,9 @@
break
else:
return None # No OpenID 2.0 service found
+ else:
+ # unknown content type
+ return None
return services, op_endpoint, op_local
def is_compat_1x(services):
More information about the Python-checkins
mailing list