Minor changes to match the style guide.
This commit is contained in:
parent
4124a0b343
commit
8ee679f0ce
|
@ -2,7 +2,7 @@
|
|||
|
||||
\index{WWW}
|
||||
\index{Internet}
|
||||
\index{World-Wide Web}
|
||||
\index{World Wide Web}
|
||||
|
||||
The modules described in this chapter implement Internet protocols and
|
||||
support for related technology. They are all implemented in Python.
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
\noindent
|
||||
Python is an extensible, interpreted, object-oriented programming
|
||||
language. It supports a wide range of applications, from simple text
|
||||
processing scripts to interactive WWW browsers.
|
||||
processing scripts to interactive Web browsers.
|
||||
|
||||
While the \citetitle[../ref/ref.html]{Python Reference Manual}
|
||||
describes the exact syntax and semantics of the language, it does not
|
||||
|
|
|
@ -17,8 +17,8 @@ simplest and most popular way to do it, but there is another very
|
|||
different technique, that lets you have nearly all the advantages of
|
||||
multi-threading, without actually using multiple threads. It's really
|
||||
only practical if your program is largely I/O bound. If your program
|
||||
is CPU bound, then pre-emptive scheduled threads are probably what
|
||||
you really need. Network servers are rarely CPU-bound, however.
|
||||
is processor bound, then pre-emptive scheduled threads are probably what
|
||||
you really need. Network servers are rarely processor bound, however.
|
||||
|
||||
If your operating system supports the \cfunction{select()} system call
|
||||
in its I/O library (and nearly all do), then you can use it to juggle
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
\index{MIME!base64 encoding}
|
||||
|
||||
This module performs base64 encoding and decoding of arbitrary binary
|
||||
strings into text strings that can be safely emailed or posted. The
|
||||
strings into text strings that can be safely sent by email or included
|
||||
as part of an HTTP POST request. The
|
||||
encoding scheme is defined in \rfc{1521} (\emph{MIME
|
||||
(Multipurpose Internet Mail Extensions) Part One: Mechanisms for
|
||||
Specifying and Describing the Format of Internet Message Bodies},
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
\index{httpd}
|
||||
|
||||
This module defines two classes for implementing HTTP servers
|
||||
(web servers). Usually, this module isn't used directly, but is used
|
||||
as a basis for building functioning web servers. See the
|
||||
(Web servers). Usually, this module isn't used directly, but is used
|
||||
as a basis for building functioning Web servers. See the
|
||||
\module{SimpleHTTPServer}\refstmodindex{SimpleHTTPServer} and
|
||||
\refmodule{CGIHTTPServer}\refstmodindex{CGIHTTPServer} modules.
|
||||
|
||||
The first class, \class{HTTPServer}, is a
|
||||
\class{SocketServer.TCPServer} subclass. It creates and listens at the
|
||||
web socket, dispatching the requests to a handler. Code to create and
|
||||
HTTP socket, dispatching the requests to a handler. Code to create and
|
||||
run the server looks like this:
|
||||
|
||||
\begin{verbatim}
|
||||
|
|
|
@ -12,7 +12,7 @@ forms in server-side scripts.}
|
|||
\index{URL}
|
||||
|
||||
|
||||
Support module for CGI (Common Gateway Interface) scripts.%
|
||||
Support module for Common Gateway Interface (CGI) scripts.%
|
||||
\index{Common Gateway Interface}
|
||||
|
||||
This module defines a number of utilities for use by CGI scripts
|
||||
|
@ -294,7 +294,7 @@ There's one important rule: if you invoke an external program (via the
|
|||
\function{os.system()} or \function{os.popen()} functions. or others
|
||||
with similar functionality), make very sure you don't pass arbitrary
|
||||
strings received from the client to the shell. This is a well-known
|
||||
security hole whereby clever hackers anywhere on the web can exploit a
|
||||
security hole whereby clever hackers anywhere on the Web can exploit a
|
||||
gullible CGI script to invoke arbitrary shell commands. Even parts of
|
||||
the URL or field names cannot be trusted, since the request doesn't
|
||||
have to come from your form!
|
||||
|
@ -330,7 +330,7 @@ as user ``nobody'', without any special privileges. It can only read
|
|||
(write, execute) files that everybody can read (write, execute). The
|
||||
current directory at execution time is also different (it is usually
|
||||
the server's cgi-bin directory) and the set of environment variables
|
||||
is also different from what you get at login. In particular, don't
|
||||
is also different from what you get when you log in. In particular, don't
|
||||
count on the shell's search path for executables (\envvar{PATH}) or
|
||||
the Python module search path (\envvar{PYTHONPATH}) to be set to
|
||||
anything interesting.
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
\section{\module{fl} ---
|
||||
FORMS library interface for GUI applications}
|
||||
FORMS library for graphical user interfaces}
|
||||
|
||||
\declaremodule{builtin}{fl}
|
||||
\platform{IRIX}
|
||||
\modulesynopsis{FORMS library interface for GUI applications.}
|
||||
\modulesynopsis{FORMS library for applications with graphical user
|
||||
interfaces.}
|
||||
|
||||
|
||||
This module provides an interface to the FORMS Library\index{FORMS
|
||||
|
|
|
@ -200,7 +200,7 @@ need to inherit any implementation.
|
|||
The standard formatter. This implementation has demonstrated wide
|
||||
applicability to many writers, and may be used directly in most
|
||||
circumstances. It has been used to implement a full-featured
|
||||
world-wide web browser.
|
||||
World Wide Web browser.
|
||||
\end{classdesc}
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ interfaces that are highly specific to Python, like printing a stack
|
|||
trace; some provide interfaces that are specific to particular
|
||||
operating systems, such as access to specific hardware; others provide
|
||||
interfaces that are
|
||||
specific to a particular application domain, like the World-Wide Web.
|
||||
specific to a particular application domain, like the World Wide Web.
|
||||
Some modules are available in all versions and ports of Python; others
|
||||
are only available when the underlying system supports or requires
|
||||
them; yet others are available only when a particular configuration
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
\section{\module{os} ---
|
||||
Miscellaneous OS interfaces}
|
||||
Miscellaneous operating system interfaces}
|
||||
|
||||
\declaremodule{standard}{os}
|
||||
\modulesynopsis{Miscellaneous OS interfaces.}
|
||||
\modulesynopsis{Miscellaneous operating system interfaces.}
|
||||
|
||||
|
||||
This module provides a more portable way of using operating system
|
||||
(OS) dependent functionality than importing an OS dependent built-in
|
||||
module like \refmodule{posix} or \module{nt}.
|
||||
dependent functionality than importing a operating system dependent
|
||||
built-in module like \refmodule{posix} or \module{nt}.
|
||||
|
||||
This module searches for an OS dependent built-in module like
|
||||
This module searches for an operating system dependent built-in module like
|
||||
\module{mac} or \refmodule{posix} and exports the same functions and data
|
||||
as found there. The design of all Python's built-in OS dependent
|
||||
as found there. The design of all Python's built-in operating system dependent
|
||||
modules is such that as long as the same functionality is available,
|
||||
it uses the same interface; for example, the function
|
||||
\code{os.stat(\var{path})} returns stat information about \var{path} in
|
||||
the same format (which happens to have originated with the
|
||||
\POSIX{} interface).
|
||||
|
||||
Extensions peculiar to a particular OS are also available through the
|
||||
\module{os} module, but using them is of course a threat to
|
||||
portability!
|
||||
Extensions peculiar to a particular operating system are also
|
||||
available through the \module{os} module, but using them is of course a
|
||||
threat to portability!
|
||||
|
||||
Note that after the first time \module{os} is imported, there is
|
||||
\emph{no} performance penalty in using functions from \module{os}
|
||||
instead of directly from the OS dependent built-in module, so there
|
||||
should be \emph{no} reason not to use \module{os}!
|
||||
instead of directly from the operating system dependent built-in module,
|
||||
so there should be \emph{no} reason not to use \module{os}!
|
||||
|
||||
|
||||
% Frank Stajano <fstajano@uk.research.att.com> complained that it
|
||||
|
@ -65,13 +65,13 @@ When exceptions are strings, the string for the exception is
|
|||
\end{excdesc}
|
||||
|
||||
\begin{datadesc}{name}
|
||||
The name of the OS dependent module imported. The following names
|
||||
have currently been registered: \code{'posix'}, \code{'nt'},
|
||||
The name of the operating system dependent module imported. The
|
||||
following names have currently been registered: \code{'posix'}, \code{'nt'},
|
||||
\code{'dos'}, \code{'mac'}, \code{'os2'}, \code{'ce'}, \code{'java'}.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{path}
|
||||
The corresponding OS dependent standard module for pathname
|
||||
The corresponding operating system dependent standard module for pathname
|
||||
operations, such as \module{posixpath} or \module{macpath}. Thus,
|
||||
given the proper imports, \code{os.path.split(\var{file})} is
|
||||
equivalent to but more portable than
|
||||
|
@ -636,7 +636,7 @@ is \code{0777} (octal).
|
|||
Return system configuration information relevant to a named file.
|
||||
\var{name} specifies the configuration value to retrieve; it may be a
|
||||
string which is the name of a defined system value; these names are
|
||||
specified in a number of standards (\POSIX.1, Unix95, Unix98, and
|
||||
specified in a number of standards (\POSIX.1, \UNIX 95, \UNIX 98, and
|
||||
others). Some platforms define additional names as well. The names
|
||||
known to the host operating system are given in the
|
||||
\code{pathconf_names} dictionary. For configuration variables not
|
||||
|
@ -737,9 +737,9 @@ order
|
|||
\code{st_mtime},
|
||||
\code{st_ctime}.
|
||||
More items may be added at the end by some implementations. Note that
|
||||
on the Macintosh, the time values are floating point values, like all
|
||||
time values on the Macintosh.
|
||||
(On MS Windows, some items are filled with dummy values.)
|
||||
on the Mac OS, the time values are floating point values, like all
|
||||
time values on the Mac OS.
|
||||
(On Windows, some items are filled with dummy values.)
|
||||
Availability: Macintosh, \UNIX{}, Windows.
|
||||
|
||||
Note: The standard module \refmodule{stat}\refstmodindex{stat} defines
|
||||
|
@ -983,8 +983,9 @@ Availability: Windows.
|
|||
\begin{funcdesc}{startfile}{path}
|
||||
Start a file with its associated application. This acts like
|
||||
double-clicking the file in Windows Explorer, or giving the file name
|
||||
as an argument to the DOS \program{start} command: the file is opened
|
||||
with whatever application (if any) its extension is associated.
|
||||
as an argument to the \program{start} command from the interactive
|
||||
command shell: the file is opened with whatever application (if any)
|
||||
its extension is associated.
|
||||
|
||||
\function{startfile()} returns as soon as the associated application
|
||||
is launched. There is no option to wait for the application to close,
|
||||
|
@ -1012,8 +1013,8 @@ Availability: \UNIX{}, Windows.
|
|||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{times}{}
|
||||
Return a 5-tuple of floating point numbers indicating accumulated (CPU
|
||||
or other)
|
||||
Return a 5-tuple of floating point numbers indicating accumulated
|
||||
(processor or other)
|
||||
times, in seconds. The items are: user time, system time, children's
|
||||
user time, children's system time, and elapsed real time since a fixed
|
||||
point in the past, in that order. See the \UNIX{} manual page
|
||||
|
@ -1100,7 +1101,7 @@ Availability: \UNIX{}.
|
|||
Return string-valued system configuration values.
|
||||
\var{name} specifies the configuration value to retrieve; it may be a
|
||||
string which is the name of a defined system value; these names are
|
||||
specified in a number of standards (\POSIX, Unix95, Unix98, and
|
||||
specified in a number of standards (\POSIX, \UNIX 95, \UNIX 98, and
|
||||
others). Some platforms define additional names as well. The names
|
||||
known to the host operating system are given in the
|
||||
\code{confstr_names} dictionary. For configuration variables not
|
||||
|
@ -1151,17 +1152,19 @@ Higher-level operations on pathnames are defined in the
|
|||
|
||||
|
||||
\begin{datadesc}{curdir}
|
||||
The constant string used by the OS to refer to the current directory.
|
||||
The constant string used by the operating system to refer to the current
|
||||
directory.
|
||||
For example: \code{'.'} for \POSIX{} or \code{':'} for the Macintosh.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{pardir}
|
||||
The constant string used by the OS to refer to the parent directory.
|
||||
The constant string used by the operating system to refer to the parent
|
||||
directory.
|
||||
For example: \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{sep}
|
||||
The character used by the OS to separate pathname components,
|
||||
The character used by the operating system to separate pathname components,
|
||||
for example, \character{/} for \POSIX{} or \character{:} for the
|
||||
Macintosh. Note that knowing this is not sufficient to be able to
|
||||
parse or concatenate pathnames --- use \function{os.path.split()} and
|
||||
|
@ -1169,15 +1172,16 @@ parse or concatenate pathnames --- use \function{os.path.split()} and
|
|||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{altsep}
|
||||
An alternative character used by the OS to separate pathname components,
|
||||
or \code{None} if only one separator character exists. This is set to
|
||||
\character{/} on DOS and Windows systems where \code{sep} is a backslash.
|
||||
An alternative character used by the operating system to separate pathname
|
||||
components, or \code{None} if only one separator character exists. This is
|
||||
set to \character{/} on DOS and Windows systems where \code{sep} is a
|
||||
backslash.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{pathsep}
|
||||
The character conventionally used by the OS to separate search patch
|
||||
components (as in \envvar{PATH}), such as \character{:} for \POSIX{} or
|
||||
\character{;} for DOS and Windows.
|
||||
The character conventionally used by the operating system to separate
|
||||
search patch components (as in \envvar{PATH}), such as \character{:} for
|
||||
\POSIX{} or \character{;} for DOS and Windows.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{defpath}
|
||||
|
@ -1188,6 +1192,6 @@ doesn't have a \code{'PATH'} key.
|
|||
\begin{datadesc}{linesep}
|
||||
The string used to separate (or, rather, terminate) lines on the
|
||||
current platform. This may be a single character, such as \code{'\e
|
||||
n'} for \POSIX{} or \code{'\e r'} for MacOS, or multiple characters,
|
||||
for example, \code{'\e r\e n'} for MS-DOS and MS Windows.
|
||||
n'} for \POSIX{} or \code{'\e r'} for the Mac OS, or multiple characters,
|
||||
for example, \code{'\e r\e n'} for DOS and Windows.
|
||||
\end{datadesc}
|
||||
|
|
|
@ -60,7 +60,7 @@ For more details, read the module file.
|
|||
|
||||
This module provides access to the
|
||||
\emph{Panel Library}
|
||||
built by NASA Ames\index{NASA} (to get it, send e-mail to
|
||||
built by NASA Ames\index{NASA} (to get it, send email to
|
||||
\code{panel-request@nas.nasa.gov}).
|
||||
All access to it should be done through the standard module
|
||||
\code{panel}\refstmodindex{panel},
|
||||
|
|
|
@ -77,7 +77,7 @@ value to denote the same resource.
|
|||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{RLIMIT_CPU}
|
||||
The maximum amount of CPU time (in seconds) that a process can
|
||||
The maximum amount of processor time (in seconds) that a process can
|
||||
use. If this limit is exceeded, a \constant{SIGXCPU} signal is sent to
|
||||
the process. (See the \refmodule{signal} module documentation for
|
||||
information about how to catch this signal and do something useful,
|
||||
|
|
|
@ -4,11 +4,11 @@ In general, Python programs have complete access to the underlying
|
|||
operating system throug the various functions and classes, For
|
||||
example, a Python program can open any file for reading and writing by
|
||||
using the \function{open()} built-in function (provided the underlying
|
||||
OS gives you permission!). This is exactly what you want for most
|
||||
applications.
|
||||
operating system gives you permission!). This is exactly what you want
|
||||
for most applications.
|
||||
|
||||
There exists a class of applications for which this ``openness'' is
|
||||
inappropriate. Take Grail: a web browser that accepts ``applets,''
|
||||
inappropriate. Take Grail: a Web browser that accepts ``applets,''
|
||||
snippets of Python code, from anywhere on the Internet for execution
|
||||
on the local system. This can be used to improve the user interface
|
||||
of forms, for instance. Since the originator of the code is unknown,
|
||||
|
|
|
@ -18,7 +18,7 @@ can subclass \class{RExec} to add or remove capabilities as desired.
|
|||
\emph{Note:} The \class{RExec} class can prevent code from performing
|
||||
unsafe operations like reading or writing disk files, or using TCP/IP
|
||||
sockets. However, it does not protect against code using extremely
|
||||
large amounts of memory or CPU time.
|
||||
large amounts of memory or processor time.
|
||||
|
||||
\begin{classdesc}{RExec}{\optional{hooks\optional{, verbose}}}
|
||||
Returns an instance of the \class{RExec} class.
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
\sectionauthor{Skip Montanaro}{skip@mojam.com}
|
||||
|
||||
\index{WWW}
|
||||
\index{World-Wide Web}
|
||||
\index{World Wide Web}
|
||||
\index{URL}
|
||||
\index{robots.txt}
|
||||
|
||||
This module provides a single class, \class{RobotFileParser}, which answers
|
||||
questions about whether or not a particular user agent can fetch a URL on
|
||||
the web site that published the \file{robots.txt} file. For more details on
|
||||
the Web site that published the \file{robots.txt} file. For more details on
|
||||
the structure of \file{robots.txt} files, see
|
||||
\url{http://info.webcrawler.com/mak/projects/robots/norobots.html}.
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ native toolkit interfaces for the Macintosh.
|
|||
|
||||
|
||||
\section{\module{stdwin} ---
|
||||
Platform-independent GUI System}
|
||||
Platform-independent Graphical User Interface System}
|
||||
|
||||
\declaremodule{builtin}{stdwin}
|
||||
\modulesynopsis{Older GUI system for X11 and Macintosh.}
|
||||
\modulesynopsis{Older graphical user interface system for X11 and Macintosh.}
|
||||
|
||||
|
||||
This module defines several new object types and functions that
|
||||
|
|
|
@ -126,11 +126,12 @@ the C function of the same name, there is no trailing newline.
|
|||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{clock}{}
|
||||
Return the current CPU time as a floating point number expressed in
|
||||
Return the current processor time as a floating point number expressed in
|
||||
seconds. The precision, and in fact the very definition of the meaning
|
||||
of ``CPU time''\index{CPU time}, depends on that of the C function
|
||||
of the same name, but in any case, this is the function to use for
|
||||
benchmarking\index{benchmarking} Python or timing algorithms.
|
||||
of ``processor time''\index{CPU time}\index{processor time}, depends on
|
||||
that of the C function of the same name, but in any case, this is the
|
||||
function to use for benchmarking\index{benchmarking} Python or timing
|
||||
algorithms.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{ctime}{\optional{secs}}
|
||||
|
|
|
@ -627,7 +627,7 @@ be of interest when inspecting the results of running a set of tests:
|
|||
The following methods of the \class{TestResult} class are used to
|
||||
maintain the internal data structures, and mmay be extended in
|
||||
subclasses to support additional reporting requirements. This is
|
||||
particularly useful in building GUI tools which support interactive
|
||||
particularly useful in building tools which support interactive
|
||||
reporting while tests are being run.
|
||||
|
||||
\begin{methoddesc}[TestResult]{startTest}{test}
|
||||
|
@ -667,8 +667,8 @@ One additional method is available for \class{TestResult} objects:
|
|||
\class{TestRunner} object return to its caller without running any
|
||||
additional tests. This is used by the \class{TextTestRunner} class
|
||||
to stop the test framework when the user signals an interrupt from
|
||||
the keyboard. GUI tools which provide runners can use this in a
|
||||
similar manner.
|
||||
the keyboard. Interactive tools which provide runners can use this
|
||||
in a similar manner.
|
||||
\end{methoddesc}
|
||||
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
\modulesynopsis{Open an arbitrary network resource by URL (requires sockets).}
|
||||
|
||||
\index{WWW}
|
||||
\index{World-Wide Web}
|
||||
\index{World Wide Web}
|
||||
\index{URL}
|
||||
|
||||
|
||||
This module provides a high-level interface for fetching data across
|
||||
the World-Wide Web. In particular, the \function{urlopen()} function
|
||||
the World Wide Web. In particular, the \function{urlopen()} function
|
||||
is similar to the built-in function \function{open()}, but accepts
|
||||
Universal Resource Locators (URLs) instead of filenames. Some
|
||||
restrictions apply --- it can only open URLs for reading, and no seek
|
||||
|
@ -249,7 +249,7 @@ protocol. This can sometimes cause confusing error messages.
|
|||
The \function{urlopen()} and \function{urlretrieve()} functions can
|
||||
cause arbitrarily long delays while waiting for a network connection
|
||||
to be set up. This means that it is difficult to build an interactive
|
||||
web client using these functions without using threads.
|
||||
Web client using these functions without using threads.
|
||||
|
||||
\item
|
||||
The data returned by \function{urlopen()} or \function{urlretrieve()}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
\modulesynopsis{Parse URLs into components.}
|
||||
|
||||
\index{WWW}
|
||||
\index{World-Wide Web}
|
||||
\index{World Wide Web}
|
||||
\index{URL}
|
||||
\indexii{URL}{parsing}
|
||||
\indexii{relative}{URL}
|
||||
|
|
|
@ -281,7 +281,7 @@ triggers a warning.
|
|||
|
||||
\begin{seealso}
|
||||
\seetitle[http://www.w3.org/TR/REC-xml-names/]{Namespaces in XML}{
|
||||
This World-Wide Web Consortium recommendation describes the
|
||||
This World Wide Web Consortium recommendation describes the
|
||||
proper syntax and processing requirements for namespaces in
|
||||
XML.}
|
||||
\end{seealso}
|
||||
|
|
Loading…
Reference in New Issue