Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / node564.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="prev" href="simple-xmlrpc-servers.html" />
13<link rel="parent" href="module-SimpleXMLRPCServer.html" />
14<link rel="next" href="module-DocXMLRPCServer.html" />
15<meta name='aesop' content='information' />
16<title>11.23.2 CGIXMLRPCRequestHandler</title>
17</head>
18<body>
19<DIV CLASS="navigation">
20<div id='top-navigation-panel' xml:id='top-navigation-panel'>
21<table align="center" width="100%" cellpadding="0" cellspacing="2">
22<tr>
23<td class='online-navigation'><a rel="prev" title="11.23.1 SimpleXMLRPCServer Objects"
24 href="simple-xmlrpc-servers.html"><img src='../icons/previous.png'
25 border='0' height='32' alt='Previous Page' width='32' /></A></td>
26<td class='online-navigation'><a rel="parent" title="11.23 SimpleXMLRPCServer "
27 href="module-SimpleXMLRPCServer.html"><img src='../icons/up.png'
28 border='0' height='32' alt='Up One Level' width='32' /></A></td>
29<td class='online-navigation'><a rel="next" title="11.24 DocXMLRPCServer "
30 href="module-DocXMLRPCServer.html"><img src='../icons/next.png'
31 border='0' height='32' alt='Next Page' width='32' /></A></td>
32<td align="center" width="100%">Python Library Reference</td>
33<td class='online-navigation'><a rel="contents" title="Table of Contents"
34 href="contents.html"><img src='../icons/contents.png'
35 border='0' height='32' alt='Contents' width='32' /></A></td>
36<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
37 border='0' height='32' alt='Module Index' width='32' /></a></td>
38<td class='online-navigation'><a rel="index" title="Index"
39 href="genindex.html"><img src='../icons/index.png'
40 border='0' height='32' alt='Index' width='32' /></A></td>
41</tr></table>
42<div class='online-navigation'>
43<b class="navlabel">Previous:</b>
44<a class="sectref" rel="prev" href="simple-xmlrpc-servers.html">11.23.1 SimpleXMLRPCServer Objects</A>
45<b class="navlabel">Up:</b>
46<a class="sectref" rel="parent" href="module-SimpleXMLRPCServer.html">11.23 SimpleXMLRPCServer </A>
47<b class="navlabel">Next:</b>
48<a class="sectref" rel="next" href="module-DocXMLRPCServer.html">11.24 DocXMLRPCServer </A>
49</div>
50<hr /></div>
51</DIV>
52<!--End of Navigation Panel-->
53
54<H2><A NAME="SECTION00132320000000000000000">
5511.23.2 CGIXMLRPCRequestHandler</A>
56</H2>
57
58<P>
59The <tt class="class">CGIXMLRPCRequestHandler</tt> class can be used to
60handle XML-RPC requests sent to Python CGI scripts.
61
62<P>
63<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
64 <td><nobr><b><tt id='l2h-3727' xml:id='l2h-3727' class="method">register_function</tt></b>(</nobr></td>
65 <td><var>function</var><big>[</big><var>, name</var><big>]</big><var></var>)</td></tr></table></dt>
66<dd>
67Register a function that can respond to XML-RPC requests. If
68<var>name</var> is given, it will be the method name associated with
69function, otherwise <var>function.__name__</var> will be used. <var>name</var>
70can be either a normal or Unicode string, and may contain
71characters not legal in Python identifiers, including the period
72character.
73</dl>
74
75<P>
76<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
77 <td><nobr><b><tt id='l2h-3728' xml:id='l2h-3728' class="method">register_instance</tt></b>(</nobr></td>
78 <td><var>instance</var>)</td></tr></table></dt>
79<dd>
80Register an object which is used to expose method names
81which have not been registered using <tt class="method">register_function()</tt>. If
82instance contains a <tt class="method">_dispatch()</tt> method, it is called with the
83requested method name and the parameters from the
84request; the return value is returned to the client as the result.
85If instance does not have a <tt class="method">_dispatch()</tt> method, it is searched
86for an attribute matching the name of the requested method; if
87the requested method name contains periods, each
88component of the method name is searched for individually,
89with the effect that a simple hierarchical search is performed.
90The value found from this search is then called with the
91parameters from the request, and the return value is passed
92back to the client.
93</dl>
94
95<P>
96<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
97 <td><nobr><b><tt id='l2h-3729' xml:id='l2h-3729' class="method">register_introspection_functions</tt></b>(</nobr></td>
98 <td><var></var>)</td></tr></table></dt>
99<dd>
100Register the XML-RPC introspection functions
101<code>system.listMethods</code>, <code>system.methodHelp</code> and
102<code>system.methodSignature</code>.
103</dl>
104
105<P>
106<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
107 <td><nobr><b><tt id='l2h-3730' xml:id='l2h-3730' class="method">register_multicall_functions</tt></b>(</nobr></td>
108 <td><var></var>)</td></tr></table></dt>
109<dd>
110Register the XML-RPC multicall function <code>system.multicall</code>.
111</dl>
112
113<P>
114<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
115 <td><nobr><b><tt id='l2h-3731' xml:id='l2h-3731' class="method">handle_request</tt></b>(</nobr></td>
116 <td><var></var><big>[</big><var>request_text = None</var><big>]</big><var></var>)</td></tr></table></dt>
117<dd>
118Handle a XML-RPC request. If <var>request_text</var> is given, it
119should be the POST data provided by the HTTP server,
120otherwise the contents of stdin will be used.
121</dl>
122
123<P>
124Example:
125
126<P>
127<div class="verbatim"><pre>
128class MyFuncs:
129 def div(self, x, y) : return div(x,y)
130
131
132handler = CGIXMLRPCRequestHandler()
133handler.register_function(pow)
134handler.register_function(lambda x,y: x+y, 'add')
135handler.register_introspection_functions()
136handler.register_instance(MyFuncs())
137handler.handle_request()
138</pre></div>
139
140<DIV CLASS="navigation">
141<div class='online-navigation'>
142<p></p><hr />
143<table align="center" width="100%" cellpadding="0" cellspacing="2">
144<tr>
145<td class='online-navigation'><a rel="prev" title="11.23.1 SimpleXMLRPCServer Objects"
146 href="simple-xmlrpc-servers.html"><img src='../icons/previous.png'
147 border='0' height='32' alt='Previous Page' width='32' /></A></td>
148<td class='online-navigation'><a rel="parent" title="11.23 SimpleXMLRPCServer "
149 href="module-SimpleXMLRPCServer.html"><img src='../icons/up.png'
150 border='0' height='32' alt='Up One Level' width='32' /></A></td>
151<td class='online-navigation'><a rel="next" title="11.24 DocXMLRPCServer "
152 href="module-DocXMLRPCServer.html"><img src='../icons/next.png'
153 border='0' height='32' alt='Next Page' width='32' /></A></td>
154<td align="center" width="100%">Python Library Reference</td>
155<td class='online-navigation'><a rel="contents" title="Table of Contents"
156 href="contents.html"><img src='../icons/contents.png'
157 border='0' height='32' alt='Contents' width='32' /></A></td>
158<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
159 border='0' height='32' alt='Module Index' width='32' /></a></td>
160<td class='online-navigation'><a rel="index" title="Index"
161 href="genindex.html"><img src='../icons/index.png'
162 border='0' height='32' alt='Index' width='32' /></A></td>
163</tr></table>
164<div class='online-navigation'>
165<b class="navlabel">Previous:</b>
166<a class="sectref" rel="prev" href="simple-xmlrpc-servers.html">11.23.1 SimpleXMLRPCServer Objects</A>
167<b class="navlabel">Up:</b>
168<a class="sectref" rel="parent" href="module-SimpleXMLRPCServer.html">11.23 SimpleXMLRPCServer </A>
169<b class="navlabel">Next:</b>
170<a class="sectref" rel="next" href="module-DocXMLRPCServer.html">11.24 DocXMLRPCServer </A>
171</div>
172</div>
173<hr />
174<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
175</DIV>
176<!--End of Navigation Panel-->
177<ADDRESS>
178See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
179</ADDRESS>
180</BODY>
181</HTML>