From 54b98b4e058e2d27ccc4c2e655f1d48df1fc805a Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 29 Oct 2012 09:28:19 -0500 Subject: [PATCH] fixed issue 1118, reload page when called by component, thanks Paolo --- VERSION | 2 +- gluon/http.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index c9a3333a..1dc141f8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.2.1 (2012-10-29 09:06:49) stable +Version 2.2.1 (2012-10-29 09:28:14) stable diff --git a/gluon/http.py b/gluon/http.py index 831c04d6..bd1f1411 100644 --- a/gluon/http.py +++ b/gluon/http.py @@ -140,7 +140,7 @@ class HTTP(BaseException): return self.message -def redirect(location, how=303, client_side=False): +def redirect(location='', how=303, client_side=False): if location: from gluon import current loc = location.replace('\r', '%0D').replace('\n', '%0A') @@ -150,3 +150,8 @@ def redirect(location, how=303, client_side=False): raise HTTP(how, 'You are being redirected here' % loc, Location=loc) + else: + from gluon import current + if client_side and current.request.ajax: + raise HTTP(200, **{'web2py-component-command': 'window.location.reload(true)'}) + \ No newline at end of file