From b2a263b48544d235f3704599fed074b5b24f4e41 Mon Sep 17 00:00:00 2001 From: Emmanuel Raviart Date: Wed, 11 Aug 2004 10:12:14 +0000 Subject: In Python simulator, redirect now accepts partial URLs. --- python/tests/websimulator.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'python') diff --git a/python/tests/websimulator.py b/python/tests/websimulator.py index cd75195d..1a07e8b5 100644 --- a/python/tests/websimulator.py +++ b/python/tests/websimulator.py @@ -103,6 +103,18 @@ class HttpRequestHandler(abstractweb.HttpRequestHandlerMixin, object): return session def respondRedirectTemporarily(self, url): + scheme = url.split('://')[0].lower() + if scheme not in ('http', 'https'): + # The url doesn't include host name => add it. + path = url + url = self.site.url + if path: + if path[0] == '/': + while url[-1] == '/': + url = url[:-1] + elif url[-1] != '/': + url += '/' + url += path return self.httpRequest.client.redirect(url) -- cgit