[Pypi-checkins] r758 - trunk/pypi
martin.von.loewis
python-checkins at python.org
Sun Apr 18 10:37:08 CEST 2010
Author: martin.von.loewis
Date: Sun Apr 18 10:37:08 2010
New Revision: 758
Modified:
trunk/pypi/openid.py
Log:
Issue #2987103: support application/xhtml+xml documents
for HTML-Based Discovery.
Modified: trunk/pypi/openid.py
==============================================================================
--- trunk/pypi/openid.py (original)
+++ trunk/pypi/openid.py Sun Apr 18 10:37:08 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 Pypi-checkins
mailing list