我正在开发一个玩具网络框架,并且我已经实现了一个方法 redirect_to 用于将用户重定向到指定的 URL。这里的代码
def _redirect_to(_self, _url):
"""Takes an url as argument and returns a location header"""
return ([('Location', _url)], "") # --- (i)
返回的元组然后由应用程序处理,这里是代码
...
else:
status = '200 OK'
params['_GET'] = get_data(_environment)
params['_POST'] = post_data(_environment)
(headers, response) = objview(objcontroller, _params = params) # tuple from (i) is stored here
_start_response(status, headers)
但是它不起作用。以下是我的浏览器收到的标头:
Content-Length:0
Date:Thu, 19 Jul 2012 06:03:52 GMT
Location:http://google.com
Server:WSGIServer/0.1 Python/2.7.3
标题有问题吗??
干杯,
乌察夫