ó
m´´Kc           @   s¦   d  Z  d d l m Z d d l Td d l Td d l m Z d d l m Z d d l	 m
 Z
 m Z d d l m Z e e ƒ Z e j j d ƒ d	 e f d
 „  ƒ  YZ d S(   s)   
Provides encoded I{marshaller} classes.
iÿÿÿÿ(   t	   getLogger(   t   *(   t   Literal(   t   Typer(   t   Factoryt   Object(   t	   TypeQueryt   atyt   Encodedc           B   s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   sg   
    A SOAP section (5) encoding marshaller.
    This marshaller supports rpc/encoded soap styles.
    c         C   s”   t  j |  | ƒ } | r� t | j t t f ƒ r� | j j ƒ  } xN | D]C } t | d d ƒ rF | j	 | d j
 f | _
 |  j | ƒ PqF qF Wn  | S(   Ni    R   (   R   t   startt
   isinstancet   valuet   listt   tuplet   typet   resolvet   hasattrt   tagR   t   cast(   t   selft   contentR	   t   resolvedt   c(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/mx/encoded.pyR	   ,   s    c         C   sÙ   t  j |  | | ƒ | j d  k r& d  S| j \ } } d | d f } d } | j j } | j | ƒ } | j | d | d ƒ | j | d | d ƒ d | d }	 d | d | d t | ƒ f }
 | j	 |	 |
 ƒ d  S(	   Nt   at0i   t   at1s)   http://schemas.xmlsoap.org/soap/encoding/i    s   %s:arrayTypes	   %s:%s[%d](   s   at1s)   http://schemas.xmlsoap.org/soap/encoding/(
   R   t   endR   t   NoneR   t   itemt   getChildt	   addPrefixt   lent   set(   R   t   parentR   R   R   t   ns0t   ns1t   arrayt   childt   nameR   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/mx/encoded.pyR   =   s    !c         C   s�   | j  j ƒ  r& t j | | j ƒ d  S| j j ƒ  rL t j | | j ƒ d  Sd  } | j j } |  j ry | j j	 ƒ  } n  t j
 | | | ƒ d  S(   N(   R   t   anyR   t   autoR   t   realR   R%   t   xstqt	   namespacet   manual(   R   t   nodeR   t   nsR%   (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/mx/encoded.pyt   encodeQ   s    	c   	      C   sv  | j  d } | j j ƒ  } t j | j ƒ } g  | _ t | ƒ } | j |  j	 ƒ } | d k rp t t ƒ ‚ n  xö | j D]ë } t | t t f ƒ r« | j j | ƒ qz n  t | t ƒ râ | j } | | _ | j j | ƒ qz n  t | t ƒ r.t j | j | ƒ } | j } | | _ | j j | ƒ qz n  t j | j | ƒ } | j } | | _ | j j | ƒ qz W| | _ |  S(   sš  
        Cast the I{untyped} list items found in content I{value}.
        Each items contained in the list is checked for XSD type information.
        Items (values) that are I{untyped}, are replaced with suds objects and
        type I{metadata} is added.
        @param content: The content holding the collection.
        @type content: L{Content}
        @return: self
        @rtype: L{Encoded}
        i   N(   R   R   R   R   t   objectR%   R   R   t   executet   schemaR   t   TypeNotFoundt   qrefR   R
   R   R   t   appendR   t   __metadata__t   sxtypet   dictt   property(	   R   R   R   R   R#   t   queryt   reft   xt   md(    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/mx/encoded.pyR   ^   s:    								(   t   __name__t
   __module__t   __doc__R	   R   R.   R   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/mx/encoded.pyR   &   s
   			N(   R?   t   loggingR    t   sudst   suds.mxt   suds.mx.literalR   t   suds.mx.typerR   t   suds.sudsobjectR   R   t   suds.xsd.queryR   R=   t   logt   Contentt
   extensionsR4   R   (    (    (    sI   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/mx/encoded.pyt   <module>   s   

