annotate Doc/lib/libsimplexmlrpc.tex @ 20737:00a581bdedeb legacy-trunk

When overriding __str__ or __repr__, set the tp_print slot to NULL.
author Guido van Rossum <guido@python.org>
date Mon, 29 Oct 2001 14:33:44 +0000
parents 754b816284d1
children f187496ffaef
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}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
5 \moduleauthor{Brian Quinlan}{brianq@activestate.com}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
6 \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
7
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 The \module{SimpleXMLRPCServer} module provides a basic server
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
10 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
11 based on the \class{\refmodule{SocketServer}.TCPServer} class,
20165
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
12 and the request handler is based on the
20176
754b816284d1 Minor markup improvement.
Fred Drake <fdrake@acm.org>
parents: 20165
diff changeset
13 \class{\refmodule{BaseHTTPServer}.BaseHTTPRequestHandler} class.
20165
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
14
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 \begin{classdesc}{SimpleXMLRPCServer}{addr\optional{,
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
17 requestHandler\optional{, logRequests}}}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
18 Create a new server instance. The \var{requestHandler} parameter
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
19 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
20 \class{SimpleXMLRPCRequestHandler}. The \var{addr} and
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
21 \var{requestHandler} parameters are passed to the
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
22 \class{\refmodule{SocketServer}.TCPServer} constructor. If
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
23 \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
24 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
25 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
26 the XML-RPC protocol.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
27 \end{classdesc}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
28
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 \begin{classdesc}{SimpleXMLRPCRequestHandler}{}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
31 Create a new request handler instance. This request handler
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
32 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
33 \var{logRequests} parameter to the \class{SimpleXMLRPCServer}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
34 constructor parameter is honored.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
35 \end{classdesc}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
36
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 \subsection{SimpleXMLRPCServer Objects \label{simple-xmlrpc-servers}}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
39
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
40 The \class{SimpleXMLRPCServer} class provides two methods that an
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
41 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
42 XML-RPC protocol via the request handler.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
43
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
44 \begin{methoddesc}[SimpleXMLRPCServer]{register_function}{function\optional{,
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
45 name}}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
46 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
47 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
48 return value of \function{\refmodule{xmlrpclib}.loads()} when called
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
49 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
50 the method name associated with \var{function}, otherwise
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
51 \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
52 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
53 legal in Python identifiers, including the period character.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
54 \end{methoddesc}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
55
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
56 \begin{methoddesc}[SimpleXMLRPCServer]{register_instance}{instance}
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
57 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
58 not been registered using \method{register_function()}. If
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
59 \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
60 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
61 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
62 \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
63 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
64 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
65 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
66 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
67 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
68 return value is passed back to the client.
db82c0b40dfc Preliminary documentation for the SimpleXMLRPCServer module.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
69 \end{methoddesc}