使用web2py控制器中的参数重定向URL

时间:2016-11-19 01:02:14

标签: python python-2.7 url-redirection web2py web2py-modules

我正在尝试使用参数从forminput.html重定向到网址('表单'结果')(在我的情况下,它是一个巨大的字典,即输出)。但是当网页被重定向到results.html时,所有参数也包含在网址Url本身中,这是我们不想要的,原因有两个:安全性和网络类型的网址。
在这种情况下你能帮助我吗? 提前致谢

以下是网址示例 http://127.0.0.1:8000/AWS/form/results?csp=&ibx=&metro=&o=%7B%22se1.sv1%22%3A+%7B%22xe-0%2F2%2F1%22%3A+%7B%22Util%22%3A+66%2C%22c_name%22%3A+%22dxcon-fh26tz6s%22%2C%22c_serial%22%3A+%2215563580-A%22%7D%2C%22xe-2%2F1%2F3%22%3A+%7B%22Util%22%3A+31%2C%22c_name%22%3A+%22dxcon-fgptdigg%22%2C%22c_serial%22%3A+%2220130277-A%22%7D%2C%22xe-3%2F0%2F3%22%3A+%7B%22Util%22%3A+0%2C%22c_name%22%3A+%22SFDC-SV3-CX-SEC-01%22%2C%22c_serial%22%3A+%2220375541-A%22%7D%2C%22xe-3%2F1%2F2%22%3A+%7B%22Util%22%3A+0%2C%22c_name%22%3A+%22dxcon-ffj66n3f%22%2C%22c_serial%22%3A+%2220347645-A%22%7D%2C%22xe-3%2F2%2F3%22%3A+%7B%22Util%22%3A+0%2C%22c_name%22%3A+%22dxcon-fgsmxuat%22%2C%22c_serial%22%3A+%2220366330-A%22%7D%7D%7D#

/*this my controller, form.py*/

my_funct():
    out_dict=dict()  // out_dict is a huge dictionary with 100 of keys and values  
    return out_dict

define forminput():  
    outout=my_funct()  
    redirect(URL('form','results', vars= dict(out=output)))  

define results():  
    data=request.vars['out']  

1 个答案:

答案 0 :(得分:2)

您可以将数据存储在会话中(保留在服务器上):

define forminput():  
    session.data = my_funct()  
    redirect(URL('form', 'results'))  

define results():  
    data = session.data