From f032cf0df5b8cea34eb1d9b62ecab1410195246a Mon Sep 17 00:00:00 2001 From: Massimo Di Pierro Date: Thu, 12 Jan 2012 13:22:47 -0600 Subject: [PATCH] issue 605, https and routes_in bug fixed, thanks Jonathan --- VERSION | 2 +- gluon/rewrite.py | 8 ++++---- gluon/tests/test_router.py | 2 +- gluon/tests/test_routes.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index e155a4bc..2e52af03 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.4 (2012-01-12 12:51:07) stable +Version 1.99.4 (2012-01-12 13:22:21) stable diff --git a/gluon/rewrite.py b/gluon/rewrite.py index 00ad69e3..0b74aff1 100644 --- a/gluon/rewrite.py +++ b/gluon/rewrite.py @@ -143,7 +143,7 @@ def url_out(request, env, application, controller, function, args, other, scheme host = True if not scheme or scheme is True: if request and request.env: - scheme = request.env.get('WSGI_URL_SCHEME', 'http').lower() + scheme = request.env.get('wsgi_url_scheme', 'http').lower() else: scheme = 'http' # some reasonable default in case we need it if host is not None: @@ -476,7 +476,7 @@ def regex_uri(e, regexes, tag, default=None): host = host[:i] key = '%s:%s://%s:%s %s' % \ (e.get('REMOTE_ADDR','localhost'), - e.get('WSGI_URL_SCHEME', 'http').lower(), host, + e.get('wsgi.url_scheme', 'http').lower(), host, e.get('REQUEST_METHOD', 'get').lower(), path) for (regex, value) in regexes: if regex.match(key): @@ -688,7 +688,7 @@ def filter_url(url, method='get', remote='0.0.0.0', out=False, app=False, lang=N e = { 'REMOTE_ADDR': remote, 'REQUEST_METHOD': method, - 'WSGI_URL_SCHEME': urlscheme, + 'wsgi.url_scheme': urlscheme, 'HTTP_HOST': urlhost, 'REQUEST_URI': uri, 'PATH_INFO': path_info, @@ -812,7 +812,7 @@ class MapUrlIn(object): # see http://www.python.org/dev/peps/pep-3333/#url-reconstruction for URL composition self.remote_addr = self.env.get('REMOTE_ADDR','localhost') - self.scheme = self.env.get('WSGI_URL_SCHEME', 'http').lower() + self.scheme = self.env.get('wsgi.url_scheme', 'http').lower() self.method = self.env.get('REQUEST_METHOD', 'get').lower() self.host = self.env.get('HTTP_HOST') self.port = None diff --git a/gluon/tests/test_router.py b/gluon/tests/test_router.py index f0ef0951..d01b518c 100644 --- a/gluon/tests/test_router.py +++ b/gluon/tests/test_router.py @@ -845,7 +845,7 @@ class TestRouter(unittest.TestCase): r = Storage() r.env = Storage() r.env.http_host = 'domain.com' - r.env.WSGI_URL_SCHEME = 'httpx' # distinguish incoming scheme + r.env.wsgi_url_scheme = 'httpx' # distinguish incoming scheme self.assertEqual(str(URL(r=r, a='a', c='c', f='f')), "/a/c/f") self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)), "httpx://domain.com/a/c/f") diff --git a/gluon/tests/test_routes.py b/gluon/tests/test_routes.py index baeb7f47..9bc3cc46 100644 --- a/gluon/tests/test_routes.py +++ b/gluon/tests/test_routes.py @@ -304,7 +304,7 @@ routes_out = [ r = Storage() r.env = Storage() r.env.http_host = 'domain.com' - r.env.WSGI_URL_SCHEME = 'httpx' # distinguish incoming scheme + r.env.wsgi_url_scheme = 'httpx' # distinguish incoming scheme self.assertEqual(str(URL(r=r, a='a', c='c', f='f')), "/a/c/f") self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)), "httpx://domain.com/a/c/f")