Python CGI 事务

发布于 2024-08-16 14:43:38 字数 176 浏览 3 评论 0原文

我有一个Python CGI 处理支付交易。当用户提交表单时,CGI 被调用。提交后,CGI 需要一段时间才能执行信用卡交易。在此期间,用户可能会按下 ESC 或刷新按钮。这样做不会“杀死”CGI,这意味着脚本将继续运行以完成事务,但 CGI 的 HTML 输出将永远不会到达客户端。这意味着用户将不知道交易已完成。我该如何解决这个问题?

I have a Python CGI handling a payment transaction. When the user submits the form, the CGI is called. After submission, the CGI takes a while to perform the credit card transaction. During that time, a user might hit the ESC or refresh button. 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. This means the user will not know the transaction was completed. How can I solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

向日葵 2024-08-23 14:43:38

与您对每个 POST 所做的操作相同:不发送输出,而是将输出放入会话变量中并重定向到纯 GET 请求。这个在会话中查找消息,并清除+显示这些消息。

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. This one looks in the session for messages, and clears+displays those.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文