ó
fqKc           @   s   d  Z  d d l m Z d d l Td d l Td d l m Z d d l m Z m	 Z	 e e
  Z e j j d  d e f d     YZ d	 S(
   s-   
Provides soap encoded unmarshaller classes.
i˙˙˙˙(   t	   getLogger(   t   *(   t   Typed(   t   splitPrefixt	   Namespacet   atyt   Encodedc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   si   
    A SOAP section (5) encoding unmarshaller.
    This marshaller supports rpc/encoded soap styles.
    c         C   s!   |  j  |  t j |  |  d  S(   N(   t   setatyR   t   start(   t   selft   content(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/encoded.pyR   *   s    c         C   s5   | j  } | d  k	 r% |  j |  n  t j |  |  S(   N(   R   t   Nonet   promoteR   t   end(   R	   R
   R   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/encoded.pyR   1   s    	c         C   s*   | j  d  k r t j |  |  S| j Sd  S(   N(   R   R   R   t   postprocesst   data(   R	   R
   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/encoded.pyR   <   s    c         C   s{   d } d } | j j | |  } | d k	 rw | | _ | j d  } | d } t |  d k rw |  j | |  qw n  |  S(   s  
        Grab the (aty) soap-enc:arrayType and attach it to the
        content for proper array processing later in end().
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        @return: self
        @rtype: L{Encoded}
        t	   arrayTypes)   http://schemas.xmlsoap.org/soap/encoding/t   [i    i   N(   Ns)   http://schemas.xmlsoap.org/soap/encoding/(   R   t   nodet   getR   t   splitt   lent   applyaty(   R	   R
   t   namet   nsR   t   partst   ref(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/encoded.pyR   E   s    		
c   	      C   s   d } t  j } | j } xv | j   D]h } | j | |  } | d k r% | j | d | d  d j | d | f  } | j | |  q% q% W|  S(   sż  
        Apply the type referenced in the I{arrayType} to the content
        (child nodes) of the array.  Each element (node) in the array 
        that does not have an explicit xsi:type attribute is given one
        based on the I{arrayType}.
        @param content: An array content.
        @type content: L{Content}
        @param xty: The XSI type reference.
        @type xty: str
        @return: self
        @rtype: L{Encoded}
        t   typei    i   t   :N(	   R   t   xsinsR   t   getChildrenR   R   t	   addPrefixt   joint   set(	   R	   R
   t   xtyR   R   t   parentt   childR   t   attr(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/encoded.pyR   [   s    		c         C   sC   x3 | j  D]( \ } } t | t  r
 | | _  d Sq
 Wg  | _  d S(   sa  
        Promote (replace) the content.data with the first attribute
        of the current content.data that is a I{list}.  Note: the 
        content.data may be empty or contain only _x attributes.
        In either case, the content.data is assigned an empty list.
        @param content: An array content.
        @type content: L{Content}
        N(   R   t
   isinstancet   list(   R	   R
   t   nt   v(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/encoded.pyR   s   s
    		(	   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/encoded.pyR   $   s   						N(   R,   t   loggingR    t   sudst   suds.umxt   suds.umx.typedR   t   suds.saxR   R   R*   t   logt   Contentt
   extensionst   appendR   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/encoded.pyt   <module>   s   

