Ñò
°›—Ic @ s d Z d d k Z d d k Z d d k Z d d k Z d d k l Z d d k l Z d d k l
Z
l Z d g Z e i
e ƒ Z e d f e d f e d f e d
f e d f e d f e i d
f e i d f f Z d „ Z d „ Z d e f d „ ƒ YZ d e f d „ ƒ YZ d S( s The base WSGI XMLRPCControlleriÿÿÿÿN( t replace_header( t WSGIController( t abortt Responset XMLRPCControllert stringt arrayt booleant intt doublet structs dateTime.iso8601t base64c C sT g } xG | D]? } x6 t D]. \ } } t | | ƒ o | i | ƒ Pq q Wq
W| S( sf Returns a list of the function signature in string format based on a
tuple provided by xmlrpclib.( t XMLRPC_MAPPINGt
isinstancet append( t argst signaturet paramt typet xml_name( ( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyt
xmlrpc_sig s
c C s. t i | | ƒ } t d t i | d t ƒƒ S( s; Convienence method to return a Pylons response XMLRPC Faultt bodyt methodresponse( t xmlrpclibt FaultR t dumpst True( t codet messaget fault( ( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyt xmlrpc_fault! s c B s§ e Z d Z e Z d Z d „ Z d „ Z d „ Z d „ Z d „ Z
d „ Z d „ Z d g g e _
d
„ Z d d g d d g g e _
d „ Z d d g g e _
RS(
sÛ XML-RPC Controller that speaks WSGI
This controller handles XML-RPC responses and complies with the
`XML-RPC Specification `_ as well as
the `XML-RPC Introspection
`_
specification.
By default, methods with names containing a dot are translated to
use an underscore. For example, the `system.methodHelp` is handled
by the method :meth:`system_methodHelp`.
Methods in the XML-RPC controller will be called with the method
given in the XMLRPC body. Methods may be annotated with a signature
attribute to declare the valid arguments and return types.
For example::
class MyXML(XMLRPCController):
def userstatus(self):
return 'basic string'
userstatus.signature = [ ['string'] ]
def userinfo(self, username, age=None):
user = LookUpUser(username)
response = {'username':user.name}
if age and age > 10:
response['age'] = age
return response
userinfo.signature = [['struct', 'string'],
['struct', 'string', 'int']]
Since XML-RPC methods can take different sets of data, each set of
valid arguments is its own list. The first value in the list is the
type of the return argument. The rest of the arguments are the
types of the data that must be passed in.
In the last method in the example above, since the method can
optionally take an integer value both sets of valid parameter lists
should be provided.
Valid types that can be checked in the signature and their
corresponding Python types::
'string' - str
'array' - list
'boolean' - bool
'int' - int
'double' - float
'struct' - dict
'dateTime.iso8601' - xmlrpclib.DateTime
'base64' - xmlrpclib.Binary
The class variable ``allow_none`` is passed to xmlrpclib.dumps;
enabling it allows translating ``None`` to XML (an extension to the
XML-RPC specification)
.. note::
Requiring a signature is optional.
i @ c C s | i S( N( t rpc_kargs( t self( ( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyt _get_method_argsi s c
s | i } | i d ƒ } | o t | ƒ } n# | o t i d ƒ n t d ƒ | | i j p
| d j o2 | o t i d | i | ƒ n t d d ƒ n | d i t | d ƒ ƒ } t i | ƒ \ } } | i
| ƒ } | i | ƒ } | p6 | o t i d | ƒ n t d d
| ƒ | | ƒ St
| d ƒ oÎ | o t i d ƒ n t }
t | ƒ } xQ | i D]F } t | ƒ d
t | ƒ j o qqn | | d
j o t }
PqqqqW|
pE | o t i d ƒ n d | | i | f }
t d |
ƒ | | ƒ Sn t i | ƒ d d
} t t | | ƒ ƒ } | | | d <| d <| | d <| | _ | | _ g ‰ g ‰ g ‰ d ‡ ‡ ‡ f d † } t i | | | ƒ } t | ƒ } ˆ i d t t | d ƒ ƒ f ƒ t ˆ d d ƒ | ˆ d ˆ ˆ d ƒ | S( sW Parse an XMLRPC body for the method, and call it with the
appropriate argumentst CONTENT_LENGTHs, No Content-Length found, returning 411 errori› i sR Content-Length larger than max body length. Max: %s, Sent: %s. Returning 413 errori s XML body too larges
wsgi.inputs, Method: %r not found, returning xmlrpc faults No such method name %rR s" Checking XMLRPC argument signaturei s7 Bad argument signature recieved, returning xmlrpc faultsS Incorrect argument signature. %r recieved does not match %r signature for method %rt actiont environt start_responsec s+ ˆ i | ƒ ˆ i | ƒ ˆ i | ƒ d S( N( R t extend( t
new_statust new_headerst new_exc_info( t statust headerst exc_info( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyt change_content´ s
s Content-Lengths Content-Types text/xmlN( t _pylons_log_debugt getR t logt debugR t max_body_lengtht readR t loadst _find_method_namet _find_methodR t hasattrt FalseR R t lenR t inspectt
getargspect dictt zipR t _funct NoneR t __call__t listR t strR ( R R$ R% t log_debugt lengthR t rpc_argst orig_methodt methodt funct
valid_argst paramst sigt msgt arglistt kargsR- t output( ( R* R+ R, s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyR@ l sp
#c C sT | i | i ƒ } t | t i ƒ p
| f } n t i | d t d | i ƒ} | S( s4 Dispatch the call to the function chosen by __call__R t
allow_none( t
_inspect_callR> R
R R R R RP ( R t raw_responset response( ( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyt _dispatch_call¿ s
c C s— | i d ƒ o | i o t i d ƒ n d S| i o t i d | ƒ n y t | | d ƒ } Wn t j
o d SXt | t i ƒ o | Sd S( sM Locate a method in the controller by the specified name and
return itt _s0 Action starts with _, private action not allowedNs Looking for XMLRPC method: %r(
t
startswithR. R0 R1 t getattrR? t UnicodeEncodeErrorR
t typest
MethodType( R t nameRH ( ( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyR6 É s
c C s | i d d ƒ S( sÁ Locate a method in the controller by the appropriate name
By default, this translates method names like
'system.methodHelp' into 'system_methodHelp'.
t .RU ( t replace( R R[ ( ( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyR5 Û s c C s | i d d ƒ S( s¼ Translate an internal method name to a publicly viewable one
By default, this translates internal method names like
'blog_view' into 'blog.view'.
RU R\ ( R] ( R R[ ( ( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyt _publish_method_nameä s c C sn g } xa t | ƒ D]S } t | | ƒ } | i d ƒ o- t | t i ƒ o | i | i | ƒ ƒ q q W| S( s; Returns a list of XML-RPC methods for this XML-RPC resourceRU ( t dirRW RV R
RY RZ R R^ ( R t methodsRG t meth( ( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyt system_listMethodsí s
R c C sD | i | i | ƒ ƒ } | o t | d d ƒ St i d d ƒ Sd S( s Returns an array of array's for the valid signatures for a
method.
The first value of each array is the return value of the
method. The result is an array to indicate multiple signatures
a method may be capable of.
R t i s No such method nameN( R6 R5 RW R R ( R R[ RG ( ( s= /usr/lib/python2.6/site-packages/pylons/controllers/xmlrpc.pyt system_methodSignatureù s R c C sn | i | i | ƒ ƒ } | o? t i | ƒ } t | d d ƒ } | o | d | 7} n | St i d d ƒ S( s&