@@ -41,7 +41,7 @@ msgstr "通用网关接口 (CGI) 脚本的支持模块"
4141msgid ""
4242"This module defines a number of utilities for use by CGI scripts written in "
4343"Python."
44- msgstr ""
44+ msgstr "本模块定义了一些工具供以 Python 编写的 CGI 脚本使用。 "
4545
4646#: ../../library/cgi.rst:26
4747msgid "Introduction"
@@ -52,6 +52,7 @@ msgid ""
5252"A CGI script is invoked by an HTTP server, usually to process user input "
5353"submitted through an HTML ``<FORM>`` or ``<ISINDEX>`` element."
5454msgstr ""
55+ "CGI 脚本是由 HTTP 服务器发起调用,通常用来处理通过 HTML ``<FORM>`` 或 ``<ISINDEX>`` 元素提交的用户输入。"
5556
5657#: ../../library/cgi.rst:33
5758msgid ""
@@ -61,6 +62,9 @@ msgid ""
6162"lots of other goodies) in the script's shell environment, executes the "
6263"script, and sends the script's output back to the client."
6364msgstr ""
65+ "在大多数情况下,CGI 脚本存放在服务器的 :file:`cgi-bin` 特殊目录下。 HTTP "
66+ "服务器将有关请求的各种信息(例如客户端的主机名、所请求的 URL、查询字符串以及许多其他内容)放在脚本的 shell "
67+ "环境中,然后执行脚本,并将脚本的输出发回到客户端。"
6468
6569#: ../../library/cgi.rst:39
6670msgid ""
@@ -72,6 +76,9 @@ msgid ""
7276"the latest addition is support for file uploads from a form (if your browser"
7377" supports it)."
7478msgstr ""
79+ "脚本的输入也会被连接到客户端,并且有时表单数据也会以此方式来读取;在其他时候表单数据会通过 URL 的“查询字符串”部分来传递。 "
80+ "本模块的目标是处理不同的应用场景并向 Python 脚本提供一个更为简单的接口。 "
81+ "它还提供了一些工具为脚本调试提供帮助,而最近增加的还有对通过表单上传文件的支持(如果你的浏览器支持该功能的话)。"
7582
7683#: ../../library/cgi.rst:46
7784msgid ""
@@ -80,25 +87,28 @@ msgid ""
8087"client what kind of data is following. Python code to generate a minimal "
8188"header section looks like this::"
8289msgstr ""
90+ "CGI 脚本的输出应当由两部分组成,并由一个空行分隔。 前一部分包含一些标头,它们告诉客户端后面会提供何种数据。 生成一个最小化标头部分的 Python"
91+ " 代码如下所示::"
8392
8493#: ../../library/cgi.rst:54
8594msgid ""
8695"The second section is usually HTML, which allows the client software to "
8796"display nicely formatted text with header, in-line images, etc. Here's "
8897"Python code that prints a simple piece of HTML::"
8998msgstr ""
99+ "后一部分通常为 HTML,提供给客户端软件来显示格式良好包含标题的文本、内联图片等内容。 下面是打印一段简单 HTML 的 Python 代码::"
90100
91101#: ../../library/cgi.rst:66
92102msgid "Using the cgi module"
93- msgstr "使用cgi模块。 "
103+ msgstr "使用 cgi 模块 "
94104
95105#: ../../library/cgi.rst:68
96106msgid "Begin by writing ``import cgi``."
97- msgstr "通过敲下 ``import cgi`` 来开始 。"
107+ msgstr "先在开头添加 ``import cgi``。"
98108
99109#: ../../library/cgi.rst:70
100110msgid "When you write a new script, consider adding these lines::"
101- msgstr "当你在写一个新脚本时,考虑加上这些语句 ::"
111+ msgstr "当你在编写一个新脚本时,请考虑加上这些语句 ::"
102112
103113#: ../../library/cgi.rst:75
104114msgid ""
@@ -107,6 +117,8 @@ msgid ""
107117"the guts of your program to users of your script, you can have the reports "
108118"saved to files instead, with code like this::"
109119msgstr ""
120+ "这会激活一个特殊的异常处理句柄,它将在发生任何错误时将详细错误报告显示到 web 浏览器中。 "
121+ "如果你不希望向你的脚本的用户显示你的程序的内部细节,你可以改为将报告保存到文件中,使用这样的代码即可::"
110122
111123#: ../../library/cgi.rst:83
112124msgid ""
@@ -115,6 +127,8 @@ msgid ""
115127"time in tracking down bugs. You can always remove the ``cgitb`` line later "
116128"when you have tested your script and are confident that it works correctly."
117129msgstr ""
130+ "在脚本开发期间使用此特性会很有帮助。 :mod:`cgitb` 所产生的报告提供了在追踪程序问题时能为你节省大量时间的信息。 "
131+ "你可以在完成测试你的脚本并确信它能正确工作之后再移除 ``cgitb`` 行。"
118132
119133#: ../../library/cgi.rst:88
120134msgid ""
0 commit comments