Aborts execution and causes a 303 or 302 redirect, depending on the HTTP protocol version.
(url, code=None)
| 3202 | |
| 3203 | |
| 3204 | def redirect(url, code=None): |
| 3205 | """ Aborts execution and causes a 303 or 302 redirect, depending on |
| 3206 | the HTTP protocol version. """ |
| 3207 | if not code: |
| 3208 | code = 303 if request.get('SERVER_PROTOCOL') == "HTTP/1.1" else 302 |
| 3209 | res = response.copy(cls=HTTPResponse) |
| 3210 | res.status = code |
| 3211 | res.body = "" |
| 3212 | res.set_header('Location', urljoin(request.url, url)) |
| 3213 | raise res |
| 3214 | |
| 3215 | |
| 3216 | def _rangeiter(fp, offset, limit, bufsize=1024 * 1024): |
nothing calls this directly
no test coverage detected
searching dependent graphs…