When the browser does a refresh, it requests the same URL, so if you want
to change the URL, you'd have to do a redirect. I suppose another option
would be to send the page back with some Javascript that changes the query
string upon page load, but I'm not sure that's much better than just doing
a redirect.
Anthony
On Wednesday, December 26, 2012 8:02:49 PM UTC-5, Pearu Peterson wrote:
>
> Hi,
>
> Say, I have a controller
>
> def foo():
> if not response.vars:
> redirect(URL(vars = dict(count = 0)))
> new_count = int(response.vars.count) + 1
> # How to update response.vars.count to new count?
> return P('Hello')
>
> In a browser, when hitting http://.../foo then page is redirected to
> http://.../foo?count=0 and Hello is shown.
>
> Now, when just reloading the page, I want that the controller variables
> are updated, that is, address field is changed to http://.../foo?count=1
> and Hello is shown. How to achieve that without calling redirect again?
>
> I have tried
> response.vars.count = new_count
> without success.
>
> Regards,
> Pearu
>
--