Commit d7165154 authored by Tres Seaver's avatar Tres Seaver

Fix 'zconfig:' URIs under Python 2.7.

The code worked around a bug in the stdlib's 'urlparse.urlsplit' for
Python < 2.7; that workaround broke under 2.7.

Fixes #5
parent fbda3845
......@@ -4,6 +4,10 @@
Unreleased
----------
- Fix 'zconfig:' URIs under Python 2.7. The code worked around a bug in
the stdlib's 'urlparse.urlsplit' for Python < 2.7; that workaround broke
under 2.7. See https://github.com/Pylons/zodburi/issues/5
- Dropped support for Python 2.5.
1.1 (2012-09-12)
......
import os
import cgi
from cStringIO import StringIO
import os
import sys
import urlparse
from ZODB.config import ZODBDatabase
......@@ -167,8 +168,11 @@ class ZConfigURIResolver(object):
def __call__(self, uri):
(scheme, netloc, path, query, frag) = urlparse.urlsplit(uri)
# urlparse doesnt understand file URLs and stuffs everything into path
(scheme, netloc, path, query, frag) = urlparse.urlsplit('http:' + path)
if sys.version_info[:2] == (2, 6):
# 2.6 urlparse doesnt understand file URLs and stuffs everything
# into path
(scheme, netloc, path, query, frag
) = urlparse.urlsplit('http:' + path)
path = os.path.normpath(path)
schema_xml = self.schema_xml_template
schema = ZConfig.loadSchemaFile(StringIO(schema_xml))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment