AlkantarClanX12

Your IP : 3.129.216.15


Current Path : /opt/alt/python33/lib64/python3.3/xmlrpc/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/xmlrpc/__pycache__/server.cpython-33.pyo

�
��f��c@s�dZddlmZmZmZmZmZddlmZddlZ	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZyddlZWnek
r�eZYnXedd�Zdd�ZGd	d
�d
�ZGdd�de�ZGd
d�de
je�ZGdd�de�ZGdd�de�ZGdd�dej�ZGdd�d�ZGdd�de�Z Gdd�dee�Z!Gdd�dee�Z"e#dkr�ddl$Z$Gdd�d�Z%ed d!f�Z&e&j'e(�e&j'd"d#�d$�e&j)e%�d%e�e&j*�e+d&�e+d'�ye&j,�Wn3e-k
r�e+d(�e&j.�ej/d�YnXndS()uXML-RPC Servers.

This module can be used to create simple XML-RPC servers
by creating a server and either installing functions, a
class instance, or by extending the SimpleXMLRPCServer
class.

It can also be used to handle XML-RPC requests in a CGI
environment using CGIXMLRPCRequestHandler.

The Doc* classes can be used to create XML-RPC servers that
serve pydoc-style documentation in response to HTTP
GET requests. This documentation is dynamically generated
based on the functions and methods registered with the
server.

A list of possible usage patterns follows:

1. Install functions:

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_function(pow)
server.register_function(lambda x,y: x+y, 'add')
server.serve_forever()

2. Install an instance:

class MyFuncs:
    def __init__(self):
        # make all of the sys functions available through sys.func_name
        import sys
        self.sys = sys
    def _listMethods(self):
        # implement this method so that system.listMethods
        # knows to advertise the sys methods
        return list_public_methods(self) + \
                ['sys.' + method for method in list_public_methods(self.sys)]
    def pow(self, x, y): return pow(x, y)
    def add(self, x, y) : return x + y

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_introspection_functions()
server.register_instance(MyFuncs())
server.serve_forever()

3. Install an instance with custom dispatch method:

class Math:
    def _listMethods(self):
        # this method must be present for system.listMethods
        # to work
        return ['add', 'pow']
    def _methodHelp(self, method):
        # this method must be present for system.methodHelp
        # to work
        if method == 'add':
            return "add(2,3) => 5"
        elif method == 'pow':
            return "pow(x, y[, z]) => number"
        else:
            # By convention, return empty
            # string if no help is available
            return ""
    def _dispatch(self, method, params):
        if method == 'pow':
            return pow(*params)
        elif method == 'add':
            return params[0] + params[1]
        else:
            raise ValueError('bad method')

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_introspection_functions()
server.register_instance(Math())
server.serve_forever()

4. Subclass SimpleXMLRPCServer:

class MathServer(SimpleXMLRPCServer):
    def _dispatch(self, method, params):
        try:
            # We are forcing the 'export_' prefix on methods that are
            # callable through XML-RPC to prevent potential security
            # problems
            func = getattr(self, 'export_' + method)
        except AttributeError:
            raise Exception('method "%s" is not supported' % method)
        else:
            return func(*params)

    def export_add(self, x, y):
        return x + y

server = MathServer(("localhost", 8000))
server.serve_forever()

5. CGI script:

server = CGIXMLRPCRequestHandler()
server.register_function(pow)
server.handle_request()
i(uFaultudumpsuloadsugzip_encodeugzip_decode(uBaseHTTPRequestHandlerNcCsg|r|jd�}n	|g}x?|D]7}|jd�rPtd|��q(t||�}q(W|S(uGresolve_dotted_attribute(a, 'b.c.d') => a.b.c.d

    Resolves a dotted attribute name to an object.  Raises
    an AttributeError if any attribute in the chain starts with a '_'.

    If the optional allow_dotted_names argument is false, dots are not
    supported and this function operates similar to getattr(obj, attr).
    u.u_u(attempt to access private attribute "%s"(usplitu
startswithuAttributeErrorugetattr(uobjuattruallow_dotted_namesuattrsui((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuresolve_dotted_attributezs
	
uresolve_dotted_attributecs�fdd�t��D�S(ukReturns a list of attribute strings, found in the specified
    object, which represent callable attributescs;g|]1}|jd�rtt�|��r|�qS(u_(u
startswithucallableugetattr(u.0umember(uobj(u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu
<listcomp>�s	u'list_public_methods.<locals>.<listcomp>(udir(uobj((uobju2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyulist_public_methods�sulist_public_methodscBs�|EeZdZdZddddd�Zddd�Zddd�Zdd	�Z	d
d�Z
dddd
�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS(uSimpleXMLRPCDispatcheru&Mix-in class that dispatches XML-RPC requests.

    This class is used to register XML-RPC method handlers
    and then to dispatch them. This class doesn't need to be
    instanced directly when used by SimpleXMLRPCServer but it
    can be instanced when used by the MultiPathXMLRPCServer
    cCs7i|_d|_||_|p$d|_||_dS(Nuutf-8(ufuncsuNoneuinstanceu
allow_noneuencodinguuse_builtin_types(uselfu
allow_noneuencodinguuse_builtin_types((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu__init__�s
			uSimpleXMLRPCDispatcher.__init__cCs||_||_dS(uRegisters an instance to respond to XML-RPC requests.

        Only one instance can be installed at a time.

        If the registered instance has a _dispatch method then that
        method will be called with the name of the XML-RPC method and
        its parameters as a tuple
        e.g. instance._dispatch('add',(2,3))

        If the registered instance does not have a _dispatch method
        then the instance will be searched to find a matching method
        and, if found, will be called. Methods beginning with an '_'
        are considered private and will not be called by
        SimpleXMLRPCServer.

        If a registered function matches a XML-RPC request, then it
        will be called instead of the registered instance.

        If the optional allow_dotted_names argument is true and the
        instance does not have a _dispatch method, method names
        containing dots are supported and resolved, as long as none of
        the name segments start with an '_'.

            *** SECURITY WARNING: ***

            Enabling the allow_dotted_names options allows intruders
            to access your module's global variables and may allow
            intruders to execute arbitrary code on your machine.  Only
            use this option on a secure, closed network.

        N(uinstanceuallow_dotted_names(uselfuinstanceuallow_dotted_names((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuregister_instance�s!	u(SimpleXMLRPCDispatcher.register_instancecCs)|dkr|j}n||j|<dS(u�Registers a function to respond to XML-RPC requests.

        The optional name argument can be used to set a Unicode name
        for the function.
        N(uNoneu__name__ufuncs(uselfufunctionuname((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuregister_function�su(SimpleXMLRPCDispatcher.register_functioncCs2|jji|jd6|jd6|jd6�dS(u�Registers the XML-RPC introspection methods in the system
        namespace.

        see http://xmlrpc.usefulinc.com/doc/reserved.html
        usystem.listMethodsusystem.methodSignatureusystem.methodHelpN(ufuncsuupdateusystem_listMethodsusystem_methodSignatureusystem_methodHelp(uself((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu register_introspection_functions�s
u7SimpleXMLRPCDispatcher.register_introspection_functionscCs|jji|jd6�dS(u�Registers the XML-RPC multicall method in the system
        namespace.

        see http://www.xmlrpc.com/discuss/msgReader$1208usystem.multicallN(ufuncsuupdateusystem_multicall(uself((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuregister_multicall_functions�su3SimpleXMLRPCDispatcher.register_multicall_functionscCsy|t|d|j�\}}|dk	r<|||�}n|j||�}|f}t|ddd|jd|j�}Wn�tk
r�}z#t|d|jd|j�}WYdd}~XnNtj	�\}}	}
ttdd||	f�d|jd|j�}YnX|j
|j�S(u�Dispatches an XML-RPC method from marshalled (XML) data.

        XML-RPC methods are dispatched from the marshalled (XML) data
        using the _dispatch method and the result is returned as
        marshalled data. For backwards compatibility, a dispatch
        function can be provided as an argument (see comment in
        SimpleXMLRPCRequestHandler.do_POST) but overriding the
        existing method through subclassing is the preferred means
        of changing method dispatch behavior.
        uuse_builtin_typesumethodresponseiu
allow_noneuencodingNu%s:%s(uloadsuuse_builtin_typesuNoneu	_dispatchudumpsu
allow_noneuencodinguFaultusysuexc_infouencode(uselfudataudispatch_methodupathuparamsumethoduresponseufaultuexc_typeu	exc_valueuexc_tb((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu_marshaled_dispatch�s"	u*SimpleXMLRPCDispatcher._marshaled_dispatchcCs�t|jj��}|jdk	r�t|jd�rR|t|jj��O}q�t|jd�s�|tt|j��O}q�nt|�S(uwsystem.listMethods() => ['add', 'subtract', 'multiple']

        Returns a list of the methods supported by the server.u_listMethodsu	_dispatchN(	usetufuncsukeysuinstanceuNoneuhasattru_listMethodsulist_public_methodsusorted(uselfumethods((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyusystem_listMethodssu)SimpleXMLRPCDispatcher.system_listMethodscCsdS(u#system.methodSignature('add') => [double, int, int]

        Returns a list describing the signature of the method. In the
        above example, the add method takes two integers as arguments
        and returns a double result.

        This server does NOT support system.methodSignature.usignatures not supported((uselfumethod_name((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyusystem_methodSignature$su-SimpleXMLRPCDispatcher.system_methodSignaturecCs�d}||jkr%|j|}nz|jdk	r�t|jd�rV|jj|�St|jd�s�yt|j||j�}Wq�tk
r�Yq�Xq�n|dkr�dStj	|�SdS(u�system.methodHelp('add') => "Adds two integers together"

        Returns a string containing documentation for the specified method.u_methodHelpu	_dispatchuN(
uNoneufuncsuinstanceuhasattru_methodHelpuresolve_dotted_attributeuallow_dotted_namesuAttributeErrorupydocugetdoc(uselfumethod_nameumethod((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyusystem_methodHelp1s"
u(SimpleXMLRPCDispatcher.system_methodHelpc
Cs�g}x�|D]�}|d}|d}y |j|j||�g�Wq
tk
r�}z&|ji|jd6|jd6�WYdd}~Xq
tj�\}}}	|jidd6d||fd6�Yq
Xq
W|S(u�system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => [[4], ...]

        Allows the caller to package multiple XML-RPC calls into a single
        request.

        See http://www.xmlrpc.com/discuss/msgReader$1208
        u
methodNameuparamsu	faultCodeufaultStringNiu%s:%s(uappendu	_dispatchuFaultu	faultCodeufaultStringusysuexc_info(
uselfu	call_listuresultsucallumethod_nameuparamsufaultuexc_typeu	exc_valueuexc_tb((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyusystem_multicallPs 



 
 
u'SimpleXMLRPCDispatcher.system_multicallcCs�d}y|j|}Wnztk
r�|jdk	r�t|jd�r[|jj||�Syt|j||j�}Wq�tk
r�Yq�XnYnX|dk	r�||�St	d|��dS(u�Dispatches the XML-RPC method.

        XML-RPC calls are forwarded to a registered function that
        matches the called XML-RPC method name. If no such function
        exists then the call is forwarded to the registered instance,
        if available.

        If the registered instance has a _dispatch method then that
        method will be called with the name of the XML-RPC method and
        its parameters as a tuple
        e.g. instance._dispatch('add',(2,3))

        If the registered instance does not have a _dispatch method
        then the instance will be searched to find a matching method
        and, if found, will be called.

        Methods beginning with an '_' are considered private and will
        not be called.
        u	_dispatchumethod "%s" is not supportedN(
uNoneufuncsuKeyErroruinstanceuhasattru	_dispatchuresolve_dotted_attributeuallow_dotted_namesuAttributeErroru	Exception(uselfumethoduparamsufunc((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu	_dispatchps"



u SimpleXMLRPCDispatcher._dispatchNF(u__name__u
__module__u__qualname__u__doc__uFalseuNoneu__init__uregister_instanceuregister_functionu register_introspection_functionsuregister_multicall_functionsu_marshaled_dispatchusystem_listMethodsusystem_methodSignatureusystem_methodHelpusystem_multicallu	_dispatch(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuSimpleXMLRPCDispatcher�s$%
 uSimpleXMLRPCDispatchercBs�|EeZdZdZdZdZdZdZe	j
de	je	jB�Z
dd�Zd	d
�Zdd�Zd
d�Zdd�Zdddd�ZdS(uSimpleXMLRPCRequestHandleru�Simple XML-RPC request handler class.

    Handles all HTTP POST requests and attempts to decode them as
    XML-RPC requests.
    u/u/RPC2ixiu�
                            \s* ([^\s;]+) \s*            #content-coding
                            (;\s* q \s*=\s* ([0-9\.]+))? #q
                            cCs�i}|jjdd�}xl|jd�D][}|jj|�}|r+|jd�}|rjt|�nd}|||jd�<q+q+W|S(NuAccept-Encodinguu,ig�?i(uheadersugetusplitu	aepatternumatchugroupufloat(uselfuruaeueumatchuv((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuaccept_encodings�su+SimpleXMLRPCRequestHandler.accept_encodingscCs!|jr|j|jkSdSdS(NT(u	rpc_pathsupathuTrue(uself((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuis_rpc_path_valid�s	u,SimpleXMLRPCRequestHandler.is_rpc_path_validcCs|j�s|j�dSy�d}t|jd�}g}xV|r�t||�}|jj|�}|spPn|j|�|t|d�8}q?Wdj	|�}|j
|�}|dkr�dS|jj
|t|dd�|j�}Wn�tk
r�}z�|jd�t|jd	�r{|jjr{|jd
t|��tj�}	t|	jdd�d�}	|jd
|	�n|jdd�|j�WYdd}~Xn�X|jd�|jdd�|jdk	rEt|�|jkrE|j�jdd�}
|
rBy t|�}|jdd�Wq?tk
r;Yq?XqBqEn|jdtt|���|j�|jj |�dS(u�Handles the HTTP POST request.

        Attempts to interpret all HTTP POST requests as XML-RPC calls,
        which are forwarded to the server's _dispatch method for handling.
        Ni
iucontent-lengthisu	_dispatchi�u_send_traceback_headeruX-exceptionuASCIIubackslashreplaceuX-tracebackuContent-lengthu0i�uContent-typeutext/xmlugzipiuContent-Encodingi(i�i����(!uis_rpc_path_validu
report_404uintuheadersuminurfileureaduappendulenujoinudecode_request_contentuNoneuserveru_marshaled_dispatchugetattrupathu	Exceptionu
send_responseuhasattru_send_traceback_headerusend_headerustru	tracebacku
format_excuencodeuend_headersuencode_thresholduaccept_encodingsugetugzip_encodeuNotImplementedErroruwfileuwrite(uselfumax_chunk_sizeusize_remaininguLu
chunk_sizeuchunkudatauresponseueutraceuq((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyudo_POST�sX
	
	"



u"SimpleXMLRPCRequestHandler.do_POSTcCs�|jjdd�j�}|dkr+|S|dkr�yt|�SWq�tk
rm|jdd|�Yq�tk
r�|jdd�Yq�Xn|jdd|�|jdd	�|j�dS(
Nucontent-encodinguidentityugzipi�uencoding %r not supportedi�uerror decoding gzip contentuContent-lengthu0(	uheadersugetulowerugzip_decodeuNotImplementedErroru
send_responseu
ValueErrorusend_headeruend_headers(uselfudatauencoding((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyudecode_request_contents

u1SimpleXMLRPCRequestHandler.decode_request_contentcCs]|jd�d}|jdd�|jdtt|���|j�|jj|�dS(Ni�sNo such pageuContent-typeu
text/plainuContent-length(u
send_responseusend_headerustrulenuend_headersuwfileuwrite(uselfuresponse((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu
report_404!s

u%SimpleXMLRPCRequestHandler.report_404u-cCs&|jjr"tj|||�ndS(u$Selectively log an accepted request.N(userverulogRequestsuBaseHTTPRequestHandlerulog_request(uselfucodeusize((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyulog_request*su&SimpleXMLRPCRequestHandler.log_requestN(u/u/RPC2i����T(u__name__u
__module__u__qualname__u__doc__u	rpc_pathsuencode_thresholduwbufsizeuTrueudisable_nagle_algorithmureucompileuVERBOSEu
IGNORECASEu	aepatternuaccept_encodingsuis_rpc_path_validudo_POSTudecode_request_contentu
report_404ulog_request(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuSimpleXMLRPCRequestHandler�sG	uSimpleXMLRPCRequestHandlercBsD|EeZdZdZdZdZeddddddd�Z
dS(uSimpleXMLRPCServerugSimple XML-RPC server.

    Simple XML-RPC server that allows functions and a single instance
    to be installed to handle requests. The default implementation
    attempts to dispatch XML-RPC calls to the functions or instance
    installed in the server. Override the _dispatch method inherited
    from SimpleXMLRPCDispatcher to change this behavior.
    c	Cs�||_tj||||�tjj||||�tdk	r�ttd�r�tj|j�tj	�}|tj
O}tj|j�tj|�ndS(Nu
FD_CLOEXEC(ulogRequestsuSimpleXMLRPCDispatcheru__init__usocketserveru	TCPServerufcntluNoneuhasattrufilenouF_GETFDu
FD_CLOEXECuF_SETFD(	uselfuaddrurequestHandlerulogRequestsu
allow_noneuencodingubind_and_activateuuse_builtin_typesuflags((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu__init__Cs	
uSimpleXMLRPCServer.__init__NTF(u__name__u
__module__u__qualname__u__doc__uTrueuallow_reuse_addressuFalseu_send_traceback_headeruSimpleXMLRPCRequestHandleruNoneu__init__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuSimpleXMLRPCServer0s		uSimpleXMLRPCServercBsb|EeZdZdZeddd
dddd�Zdd�Z	dd�Z
d
d
dd	�Zd
S(
uMultiPathXMLRPCServeru\Multipath XML-RPC Server
    This specialization of SimpleXMLRPCServer allows the user to create
    multiple Dispatcher instances and assign them to different
    HTTP request paths.  This makes it possible to run two or more
    'virtual XML-RPC servers' at the same port.
    Make sure that the requestHandler accepts the paths in question.
    c	CsGtj||||||||�i|_||_|p=d|_dS(Nuutf-8(uSimpleXMLRPCServeru__init__udispatchersu
allow_noneuencoding(uselfuaddrurequestHandlerulogRequestsu
allow_noneuencodingubind_and_activateuuse_builtin_types((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu__init__[s

		uMultiPathXMLRPCServer.__init__cCs||j|<|S(N(udispatchers(uselfupathu
dispatcher((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuadd_dispatcheres
u$MultiPathXMLRPCServer.add_dispatchercCs|j|S(N(udispatchers(uselfupath((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuget_dispatcherisu$MultiPathXMLRPCServer.get_dispatchercCs�y |j|j|||�}Wngtj�dd�\}}ttdd||f�d|jd|j�}|j|j�}YnX|S(Niiu%s:%suencodingu
allow_none(	udispatchersu_marshaled_dispatchusysuexc_infoudumpsuFaultuencodingu
allow_noneuencode(uselfudataudispatch_methodupathuresponseuexc_typeu	exc_value((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu_marshaled_dispatchls
u)MultiPathXMLRPCServer._marshaled_dispatchNTF(u__name__u
__module__u__qualname__u__doc__uSimpleXMLRPCRequestHandleruTrueuFalseuNoneu__init__uadd_dispatcheruget_dispatcheru_marshaled_dispatch(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuMultiPathXMLRPCServerSs	uMultiPathXMLRPCServercBsV|EeZdZdZdd
ddd�Zdd�Zdd�Zd
dd	�Z	d
S(uCGIXMLRPCRequestHandleru3Simple handler for XML-RPC data passed through CGI.cCstj||||�dS(N(uSimpleXMLRPCDispatcheru__init__(uselfu
allow_noneuencodinguuse_builtin_types((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu__init__~su CGIXMLRPCRequestHandler.__init__cCsh|j|�}td�tdt|��t�tjj�tjjj|�tjjj�dS(uHandle a single XML-RPC requestuContent-Type: text/xmluContent-Length: %dN(u_marshaled_dispatchuprintulenusysustdoutuflushubufferuwrite(uselfurequest_texturesponse((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu
handle_xmlrpc�s

u%CGIXMLRPCRequestHandler.handle_xmlrpccCs�d}tj|\}}tjji|d6|d6|d6}|jd�}td||f�tdtjj�tdt|��t�t	j
j�t	j
jj
|�t	j
jj�d	S(
u�Handle a single HTTP GET request.

        Default implementation indicates an error because
        XML-RPC uses the POST method.
        i�ucodeumessageuexplainuutf-8u
Status: %d %suContent-Type: %suContent-Length: %dN(uBaseHTTPRequestHandleru	responsesuhttpuserveruDEFAULT_ERROR_MESSAGEuencodeuprintuDEFAULT_ERROR_CONTENT_TYPEulenusysustdoutuflushubufferuwrite(uselfucodeumessageuexplainuresponse((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu
handle_get�s	
u"CGIXMLRPCRequestHandler.handle_getc
Cs�|dkr4tjjdd�dkr4|j�nnyttjjdd��}Wnttfk
rsd}YnX|dkr�tj	j
|�}n|j|�dS(u�Handle a single XML-RPC request passed through a CGI post method.

        If no XML data is given then it is read from stdin. The resulting
        XML-RPC response is printed to stdout along with the correct HTTP
        headers.
        uREQUEST_METHODuGETuCONTENT_LENGTHiNi����(uNoneuosuenvironugetu
handle_getuintu
ValueErroru	TypeErrorusysustdinureadu
handle_xmlrpc(uselfurequest_textulength((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuhandle_request�s
u&CGIXMLRPCRequestHandler.handle_requestNF(
u__name__u
__module__u__qualname__u__doc__uFalseuNoneu__init__u
handle_xmlrpcu
handle_getuhandle_request(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuCGIXMLRPCRequestHandler{s
uCGIXMLRPCRequestHandlercBsY|EeZdZdZdiiidd�Zdiiiddd�Zdd�ZdS(	u
ServerHTMLDocu7Class used to generate pydoc HTML document for a servercCs�|p|j}g}d}tjd�}x�|j||�}	|	sIPn|	j�\}
}|j||||
���|	j�\}}
}}}}|
r�||�jdd�}|jd||f�n�|rdt|�}|jd|||�f�n�|r:dt|�}|jd|||�f�no|||d�d	krv|j|j	||||��n3|r�|jd
|�n|j|j	||��|}q-|j|||d���dj
|�S(
u�Mark up some plain text, given a context of symbols to look for.
        Each context dictionary maps object names to anchor names.iuM\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?((?:\w|\.)+))\bu"u&quot;u<a href="%s">%s</a>u'http://www.rfc-editor.org/rfc/rfc%d.txtu(http://www.python.org/dev/peps/pep-%04d/iu(uself.<strong>%s</strong>Nu(uescapeureucompileusearchuspanuappendugroupsureplaceuintunamelinkujoin(uselfutextuescapeufuncsuclassesumethodsuresultsuhereupatternumatchustartuendualluschemeurfcupepuselfdotunameuurl((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyumarkup�s8  "	uServerHTMLDoc.markupcCs�|r|jpdd|}d}	d|j|�|j|�f}
tj|�r�tj|�}tj|jdd�|j|j|j	d|j
d|j�}n]tj|�r�tj|�}tj|j|j|j|j	d|j
d|j�}nd}t
|t�r5|d	p|}|dp/d}
ntj|�}
|
||	oa|jd
|	�}|j|
|j|||�}|o�d|}d||fS(
u;Produce HTML documentation for a function or method object.uu-u$<a name="%s"><strong>%s</strong></a>iNuannotationsuformatvalueu(...)iu'<font face="helvetica, arial">%s</font>u<dd><tt>%s</tt></dd>u<dl><dt>%s</dt>%s</dl>
(u__name__uescapeuinspectuismethodugetfullargspecu
formatargspecuargsuvarargsuvarkwudefaultsuannotationsuformatvalueu
isfunctionu
isinstanceutupleupydocugetdocugreyumarkupu	preformat(uselfuobjectunameumodufuncsuclassesumethodsucluanchorunoteutitleuargsuargspecu	docstringudecludoc((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu
docroutine�s<			uServerHTMLDoc.docroutinecCsi}x6|j�D](\}}d|||<||||<qW|j|�}d|}|j|dd�}|j||j|�}	|	o�d|	}	|d|	}g}
t|j��}x3|D]+\}}|
j|j||d|��q�W||jddd	d
j	|
��}|S(u1Produce HTML documentation for an XML-RPC server.u#-u)<big><big><strong>%s</strong></big></big>u#ffffffu#7799eeu<tt>%s</tt>u
<p>%s</p>
ufuncsuMethodsu#eeaa77u(
uitemsuescapeuheadingumarkupu	preformatusorteduappendu
docroutineu
bigsectionujoin(uselfuserver_nameupackage_documentationumethodsufdictukeyuvalueuheaduresultudocucontentsumethod_items((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu	docservers"
#	uServerHTMLDoc.docserverN(u__name__u
__module__u__qualname__u__doc__uNoneumarkupu
docroutineu	docserver(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu
ServerHTMLDoc�s
),u
ServerHTMLDoccBsV|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS(
uXMLRPCDocGeneratoru�Generates documentation for an XML-RPC server.

    This class is designed as mix-in and should not
    be constructed directly.
    cCsd|_d|_d|_dS(NuXML-RPC Server DocumentationuGThis server exports the following methods through the XML-RPC protocol.(userver_nameuserver_documentationuserver_title(uself((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu__init__9s		uXMLRPCDocGenerator.__init__cCs
||_dS(u8Set the HTML title of the generated server documentationN(userver_title(uselfuserver_title((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuset_server_titleAsu#XMLRPCDocGenerator.set_server_titlecCs
||_dS(u7Set the name of the generated HTML server documentationN(userver_name(uselfuserver_name((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuset_server_nameFsu"XMLRPCDocGenerator.set_server_namecCs
||_dS(u3Set the documentation string for the entire server.N(userver_documentation(uselfuserver_documentation((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuset_server_documentationKsu+XMLRPCDocGenerator.set_server_documentationcCs^i}x|j�D]}||jkr8|j|}n�|jdk	rddg}t|jd�r~|jj|�|d<nt|jd�r�|jj|�|d<nt|�}|dkr�|}qt|jd�syt|j|�}Wqt	k
r|}YqXq|}n|||<qWt
�}|j|j|j
|�}|j|j|�S(ugenerate_html_documentation() => html documentation for the server

        Generates HTML documentation for the server using introspection for
        installed functions and instances that do not implement the
        _dispatch method. Alternatively, instances can choose to implement
        the _get_method_argstring(method_name) method to provide the
        argument string used in the documentation and the
        _methodHelp(method_name) method to provide the help text used
        in the documentation.u_get_method_argstringiu_methodHelpiu	_dispatchN(NN(usystem_listMethodsufuncsuinstanceuNoneuhasattru_get_method_argstringu_methodHelputupleuresolve_dotted_attributeuAttributeErroru
ServerHTMLDocu	docserveruserver_nameuserver_documentationupageuserver_title(uselfumethodsumethod_nameumethodumethod_infou
documenteru
documentation((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyugenerate_html_documentationPs8	

			u.XMLRPCDocGenerator.generate_html_documentationN(	u__name__u
__module__u__qualname__u__doc__u__init__uset_server_titleuset_server_nameuset_server_documentationugenerate_html_documentation(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuXMLRPCDocGenerator2suXMLRPCDocGeneratorcBs&|EeZdZdZdd�ZdS(uDocXMLRPCRequestHandleru�XML-RPC and documentation request handler class.

    Handles all HTTP POST requests and attempts to decode them as
    XML-RPC requests.

    Handles all HTTP GET requests and interprets them as requests
    for documentation.
    cCs�|j�s|j�dS|jj�jd�}|jd�|jdd�|jdtt|���|j	�|j
j|�dS(u}Handles the HTTP GET request.

        Interpret all HTTP GET requests as requests for server
        documentation.
        Nuutf-8i�uContent-typeu	text/htmluContent-length(uis_rpc_path_validu
report_404userverugenerate_html_documentationuencodeu
send_responseusend_headerustrulenuend_headersuwfileuwrite(uselfuresponse((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyudo_GET�s


uDocXMLRPCRequestHandler.do_GETN(u__name__u
__module__u__qualname__u__doc__udo_GET(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuDocXMLRPCRequestHandler�suDocXMLRPCRequestHandlercBs8|EeZdZdZeddddddd�ZdS(uDocXMLRPCServeru�XML-RPC and HTML documentation server.

    Adds the ability to serve server documentation to the capabilities
    of SimpleXMLRPCServer.
    c	Cs3tj||||||||�tj|�dS(N(uSimpleXMLRPCServeru__init__uXMLRPCDocGenerator(uselfuaddrurequestHandlerulogRequestsu
allow_noneuencodingubind_and_activateuuse_builtin_types((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu__init__�s	uDocXMLRPCServer.__init__NTF(	u__name__u
__module__u__qualname__u__doc__uDocXMLRPCRequestHandleruTrueuFalseuNoneu__init__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuDocXMLRPCServer�s	uDocXMLRPCServercBs2|EeZdZdZdd�Zdd�ZdS(uDocCGIXMLRPCRequestHandleruJHandler for XML-RPC data and documentation requests passed through
    CGIcCsn|j�jd�}td�tdt|��t�tjj�tjjj|�tjjj�dS(u}Handles the HTTP GET request.

        Interpret all HTTP GET requests as requests for server
        documentation.
        uutf-8uContent-Type: text/htmluContent-Length: %dN(	ugenerate_html_documentationuencodeuprintulenusysustdoutuflushubufferuwrite(uselfuresponse((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu
handle_get�s

u%DocCGIXMLRPCRequestHandler.handle_getcCstj|�tj|�dS(N(uCGIXMLRPCRequestHandleru__init__uXMLRPCDocGenerator(uself((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu__init__�s
u#DocCGIXMLRPCRequestHandler.__init__N(u__name__u
__module__u__qualname__u__doc__u
handle_getu__init__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuDocCGIXMLRPCRequestHandler�suDocCGIXMLRPCRequestHandleru__main__cBs3|EeZdZdd�ZGdd�d�ZdS(uExampleServicecCsdS(Nu42((uself((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyugetData�suExampleService.getDatacBs&|EeZdZedd��ZdS(uExampleService.currentTimecCs
tjj�S(N(udatetimeunow(((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyugetCurrentTime�su)ExampleService.currentTime.getCurrentTimeN(u__name__u
__module__u__qualname__ustaticmethodugetCurrentTime(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyucurrentTime�sucurrentTimeN(u__name__u
__module__u__qualname__ugetDataucurrentTime(u
__locals__((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyuExampleService�suExampleServiceu	localhosti@cCs||S(N((uxuy((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu<lambda>�su<lambda>uadduallow_dotted_namesu&Serving XML-RPC on localhost port 8000uKIt is advisable to run this example server within a secure, closed network.u&
Keyboard interrupt received, exiting.(0u__doc__u
xmlrpc.clientuFaultudumpsuloadsugzip_encodeugzip_decodeuhttp.serveruBaseHTTPRequestHandleruhttpusocketserverusysuosureupydocuinspectu	tracebackufcntluImportErroruNoneuTrueuresolve_dotted_attributeulist_public_methodsuSimpleXMLRPCDispatcheruSimpleXMLRPCRequestHandleru	TCPServeruSimpleXMLRPCServeruMultiPathXMLRPCServeruCGIXMLRPCRequestHandleruHTMLDocu
ServerHTMLDocuXMLRPCDocGeneratoruDocXMLRPCRequestHandleruDocXMLRPCServeruDocCGIXMLRPCRequestHandleru__name__udatetimeuExampleServiceuserveruregister_functionupowuregister_instanceuregister_multicall_functionsuprintu
serve_foreveruKeyboardInterruptuserver_closeuexit(((u2/opt/alt/python33/lib64/python3.3/xmlrpc/server.pyu<module>fs\(
��	"(ErQ