简体   繁体   English

Python CGI交易

[英]Python CGI transaction

I have a Python CGI handling a payment transaction. 我有一个处理付款交易的Python CGI。 When the user submits the form, the CGI is called. 当用户提交表单时,将调用CGI。 After submission, the CGI takes a while to perform the credit card transaction. 提交后,CGI需要一段时间来执行信用卡交易。 During that time, a user might hit the ESC or refresh button. 在此期间,用户可能会按下ESC或刷新按钮。 Doing that will not "kill" the CGI, meaning, the script will keep running completing the transaction but the CGI's HTML output will never reach the client. 这样做不会“杀死” CGI,这意味着脚本将继续运行以完成事务,但是CGI的HTML输出将永远不会到达客户端。 This means the user will not know the transaction was completed. 这意味着用户将不知道交易已完成。 How can I solve this problem? 我怎么解决这个问题?

Same as you should do with every POST: don't send output, but put the output in a session variable and redirect to a pure-GET request. 与您对每个POST都应该执行的操作相同:不发送输出,而是将输出放入会话变量中并重定向到纯GET请求。 This one looks in the session for messages, and clears+displays those. 这个在会话中查找消息,然后清除并显示这些消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM