Ñò
ã=Pc           @   sf   d  Z  d d k l Z d d k Td d k l Z d d k l Z e e  Z	 d e f d     YZ
 d S(	   s9   
Provides classes for the (WS) SOAP I{document/literal}.
iÿÿÿÿ(   t	   getLogger(   t   *(   t   Binding(   t   Elementt   Documentc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sc  
    The document/literal style.  Literal is the only (@use) supported
    since document/encoded is pretty much dead.
    Although the soap specification supports multiple documents within the soap
    <body/>, it is very uncommon.  As such, suds presents an I{RPC} view of
    service methods defined with a single document parameter.  This is done so 
    that the user can pass individual parameters instead of one, single document.
    To support the complete specification, service methods defined with multiple documents
    (multiple message parts), must present a I{document} view for that method.
    c         C   s1  t  | i i i i  p d S| i i i i } | o& |  i |  } |  i | d  } n g  } d } xÁ |  i |  D]° } | t  |  j  o | | }	 n | i	 | d  }	 | d 7} |  i
 | | |	  }
 |
 d  j o qy n | p/ | d i d  } |
 i | d | d  n | i |
  qy W| S(   Ni    i   t   ns0(    (   t   lent   soapt   inputt   bodyt   partst   wrappedt   bodypart_typest   documentt
   param_defst   gett   mkparamt   Nonet	   namespacet	   setPrefixt   append(   t   selft   methodt   argst   kwargsR   t   ptst   roott   nt   pdt   valuet   pt   ns(    (    sU   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/bindings/document.pyt   bodycontent)   s,     
c         C   s0   | i  i i i } | o | d i S| i Sd  S(   Ni    (   R   t   outputR	   R   t   children(   R   R   R	   R   (    (    sU   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/bindings/document.pyt   replycontentH   s    c         C   s6   | d i  } | d i d  } t | d | } | S(   s%  
        Get the document root.  For I{document/literal}, this is the
        name of the wrapper element qualifed by the schema tns.
        @param wrapper: The method name.
        @type wrapper: L{xsd.sxbase.SchemaObject}
        @return: A root element.
        @rtype: L{Element}
        i   R   R   (   t   nameR   R   (   R   t   wrappert   tagR   t   d(    (    sU   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/bindings/document.pyR   O   s    	c   	      C   sÆ   |  i  |  } | i i i i } | p | Sg  } x | D] } | d i   } xk | D]c \ } } | i   o qW n |  i |  o t i	 d | | i
  qW n | i | i
 | f  qW Wq: W| S(   Ni   s5   %s
contained by <choice/>, excluded as param for %s()(   R   R   R   R	   R   t   resolvet   isattrt   bychoicet   logt   debugR$   R   (	   R   R   R   R   t   resultR   t   resolvedt   childt   ancestry(    (    sU   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/bindings/document.pyR   ]   s(      
c   	      C   s   g  } | i  i i i } |  i | d t } | oL xS | D]= } | i d t  } x! | D] \ } } | i |  qZ WPq; Wn | | 7} | S(   NR   t	   nobuiltin(	   R   R!   R	   R   R   t   FalseR(   t   TrueR   (	   R   R   R-   R   t   rtst   ptR.   R/   R0   (    (    sU   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/bindings/document.pyt   returned_typesy   s      	
c         C   s'   x  | D] } | i    o t Sq Wt S(   sÂ   
        The ancestry contains a <choice/>
        @param ancestry: A list of ancestors.
        @type ancestry: list
        @return: True if contains <choice/>
        @rtype: boolean
        (   t   choiceR3   R2   (   R   R0   t   x(    (    sU   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/bindings/document.pyR*      s
     	(	   t   __name__t
   __module__t   __doc__R    R#   R   R   R6   R*   (    (    (    sU   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/bindings/document.pyR      s   
					N(   R;   t   loggingR    t   sudst   suds.bindings.bindingR   t   suds.sax.elementR   R9   R+   R   (    (    (    sU   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/bindings/document.pyt   <module>   s   
