annotate Doc/lib/libsimplexmlrpc.tex @ 22360:c8a6ea00a9e1 legacy-trunk

restructure a bit to not rely on test case execution ordering add test case for bug #482460
author Skip Montanaro <skip@pobox.com>
date Sun, 17 Mar 2002 23:03:42 +0000
parents f187496ffaef
children 7c34e5bf2e22
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20165
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
1 \section{\module{SimpleXMLRPCServer} ---
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
2 Basic XML-RPC server}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
3
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
4 \declaremodule{standard}{SimpleXMLRPCServer}
21063
f187496ffaef Add synopsis for the SimpleXMLRPCServer module; used in the chapter-level
Fred Drake <fdrake@acm.org>
parents: 20176
diff changeset
5 \modulesynopsis{Basic XML-RPC server implementation.}
20165
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
6 \moduleauthor{Brian Quinlan}{brianq@activestate.com}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
7 \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
8
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
9
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
10 The \module{SimpleXMLRPCServer} module provides a basic server
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
11 framework for XML-RPC servers written in Python. The server object is
20176
754b816284d1 Minor markup improvement.
Fred Drake <fdrake@acm.org>
parents: 20165
diff changeset
12 based on the \class{\refmodule{SocketServer}.TCPServer} class,
20165
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
13 and the request handler is based on the
20176
754b816284d1 Minor markup improvement.
Fred Drake <fdrake@acm.org>
parents: 20165
diff changeset
14 \class{\refmodule{BaseHTTPServer}.BaseHTTPRequestHandler} class.
20165
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
15
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
16
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
17 \begin{classdesc}{SimpleXMLRPCServer}{addr\optional{,
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
18 requestHandler\optional{, logRequests}}}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
19 Create a new server instance. The \var{requestHandler} parameter
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
20 should be a factory for request handler instances; it defaults to
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
21 \class{SimpleXMLRPCRequestHandler}. The \var{addr} and
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
22 \var{requestHandler} parameters are passed to the
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
23 \class{\refmodule{SocketServer}.TCPServer} constructor. If
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
24 \var{logRequests} is true (the default), requests will be logged;
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
25 setting this parameter to false will turn off logging. This class
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
26 provides methods for registration of functions that can be called by
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
27 the XML-RPC protocol.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
28 \end{classdesc}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
29
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
30
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
31 \begin{classdesc}{SimpleXMLRPCRequestHandler}{}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
32 Create a new request handler instance. This request handler
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
33 supports \code{POST} requests and modifies logging so that the
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
34 \var{logRequests} parameter to the \class{SimpleXMLRPCServer}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
35 constructor parameter is honored.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
36 \end{classdesc}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
37
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
38
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
39 \subsection{SimpleXMLRPCServer Objects \label{simple-xmlrpc-servers}}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
40
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
41 The \class{SimpleXMLRPCServer} class provides two methods that an
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
42 application can use to register functions that can be called via the
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
43 XML-RPC protocol via the request handler.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
44
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
45 \begin{methoddesc}[SimpleXMLRPCServer]{register_function}{function\optional{,
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
46 name}}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
47 Register a function that can respond to XML-RPC requests. The
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
48 function must be callable with a single parameter which will be the
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
49 return value of \function{\refmodule{xmlrpclib}.loads()} when called
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
50 with the payload of the request. If \var{name} is given, it will be
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
51 the method name associated with \var{function}, otherwise
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
52 \code{\var{function}.__name__} will be used. \var{name} can be
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
53 either a normal or Unicode string, and may contain characters not
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
54 legal in Python identifiers, including the period character.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
55 \end{methoddesc}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
56
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
57 \begin{methoddesc}[SimpleXMLRPCServer]{register_instance}{instance}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
58 Register an object which is used to expose method names which have
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
59 not been registered using \method{register_function()}. If
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
60 \var{instance} contains a \method{_dispatch()} method, it is called
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
61 with the requested method name and the parameters from the request;
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
62 the return value is returned to the client as the result. If
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
63 \var{instance} does not have a \method{_dispatch()} method, it is
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
64 searched for an attribute matching the name of the requested method;
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
65 if the requested method name contains periods, each component of the
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
66 method name is searched for individually, with the effect that a
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
67 simple hierarchical search is performed. The value found from this
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
68 search is then called with the parameters from the request, and the
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
69 return value is passed back to the client.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
70 \end{methoddesc}