diff --git a/deluge/ui/webui/utils.py b/deluge/ui/webui/utils.py index a2d5d8ac9..827e8e8cc 100644 --- a/deluge/ui/webui/utils.py +++ b/deluge/ui/webui/utils.py @@ -87,18 +87,36 @@ def self_url(**kwargs): return config["base"] + changequery(**kwargs) def do_redirect(): - import render - """go to /index unless the redir var is set.""" - vars = web.input(redir=None) + """for redirects after a POST""" + vars = web.input(redir = None) + ck = cookies() + url_vars = {} + if vars.redir: w_seeother(vars.redir) #redir variable contains base return - #test-alt-home - if hasattr(render,"home"): - return render.home() - #default: - seeother('/index') + #for the filters: + if ("order" in ck and "sort" in ck): + url_vars.update({'sort':ck['sort'] ,'order':ck['order'] }) + + organize = False + try: + organize = ('Organize' in sclient.get_enabled_plugins()) + except: + pass + + if organize: + #todo:DRY + if ("state" in ck) and ck['state']: + url_vars['state'] = ck['state'] + if ("tracker" in ck) and ck['tracker']: + url_vars['tracker'] = ck['tracker'] + if ("keyword" in ck) and ck['keyword']: + url_vars['keyword'] = ck['keyword'] + + #redirect. + w_seeother(url("/index", **url_vars)) def getcookie(key, default = None): "because i'm too lazy to type 3 lines for something this simple"