ó
2Á´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 e e ƒ Z i d d 6d	 d
 6Z d d d „  ƒ  YZ d S(   s9   
Provides base classes for XML->object I{unmarshalling}.
iÿÿÿÿ(   t	   getLogger(   t   *(   t   AttrList(   t   Text(   t   Factoryt   merget   clst   classt   dfnt   deft   Corec           B   sƒ   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z RS(   sr   
    The abstract XML I{node} unmarshaller.  This class provides the
    I{core} unmarshalling functionality.
    c         C   s   |  j  ƒ  |  j | ƒ S(   sè   
        Process an object graph representation of the xml I{node}.
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        @return: A suds object.
        @rtype: L{Object}
        (   t   resett   append(   t   selft   content(    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyt   process'   s    
c         C   sN   |  j  | ƒ |  j | ƒ |  j | ƒ |  j | ƒ |  j | ƒ |  j | ƒ S(   s€  
        Process the specified node and convert the XML document into
        a I{suds} L{object}.
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        @return: A I{append-result} tuple as: (L{Object}, I{value})
        @rtype: I{append-result}
        @note: This is not the proper entry point.
        @see: L{process()}
        (   t   startt   append_attributest   append_childrent   append_textt   endt   postprocess(   R   R   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR   2   s    c         C   s4  | j  } t | j ƒ r( | j ƒ  r( | St | j ƒ } | j ƒ  rŠ t | j ƒ rŠ | j ƒ  rŠ t j | j	 | j
 ƒ  ƒ } t | j | ƒ St | j ƒ r  | j S| j ƒ  } | j  j ƒ  r¿ d St | j ƒ r| j d k r|  j | ƒ rñ d St d d | ƒSn  t | j t ƒ r)t | j d | ƒS| j Sd S(   sl  
        Perform final processing of the resulting data structure as follows:
          - Mixed values (children and text) will have a result of the I{content.node}.
          - Simi-simple values (attributes, no-children and text) will have a result of a
             property object.
          - Simple values (no-attributes, no-children with text nodes) will have a string 
             result equal to the value of the content.node.getText().
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        @return: The post-processed result.
        @rtype: I{any}
        t    t   langN(   t   nodet   lent   childrent   hasTextR   t
   attributest   rlenR   t   propertyt   namet   getTextR   t   dataR   t   isnilt   Nonet   textt   nillableR   t
   isinstancet
   basestring(   R   R   R   R   t   pR   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR   D   s*    	c         C   sR   t  | j j ƒ } x9 | j ƒ  D]+ } | j } | j } |  j | | | ƒ q Wd S(   sæ   
        Append attribute nodes into L{Content.data}.
        Attributes in the I{schema} or I{xml} namespaces are skipped.
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        N(   R   R   R   t   realR   t   valuet   append_attribute(   R   R   R   t   attrR   R*   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR   i   s
    		c         C   s3   | } d t  j | | ƒ } t | j | | ƒ d S(   s;  
        Append an attribute name/value into L{Content.data}.
        @param name: The attribute name
        @type name: basestring
        @param value: The attribute's value
        @type value: basestring
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        s   _%sN(   t   reservedt   gett   setattrR!   (   R   R   R*   R   t   key(    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR+   v   s    
c         C   s  x | j  D]õ } t | ƒ } |  j | ƒ } t j | j | j ƒ } | | j k r¢ t | j | ƒ } t | t	 ƒ rƒ | j | ƒ q
 t
 | j | | | g ƒ q
 n  |  j | ƒ rì | d k rÓ t
 | j | g  ƒ qÿ t
 | j | | g ƒ q
 t
 | j | | ƒ q
 Wd S(   s›   
        Append child nodes into L{Content.data}
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        N(   R   t   ContentR   R-   R.   R   R!   t   getattrR&   t   listR/   t	   unboundedR#   (   R   R   t   childt   contt   cvalR0   t   v(    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR   „   s    c         C   s(   | j  j ƒ  r$ | j  j ƒ  | _ n  d S(   sš   
        Append text nodes into L{Content.data}
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        N(   R   R   R    R$   (   R   R   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR   �   s    c         C   s   d  S(   N(    (   R   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR   ¦   s    c         C   s   t  j | j j ƒ | _ d S(   s  
        Processing on I{node} has started.  Build and return
        the proper object.
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        @return: A subclass of Object.
        @rtype: L{Object}
        N(   R   t   objectR   R   R!   (   R   R   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR   ©   s    	c         C   s   d S(   s”   
        Processing on I{node} has ended.
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        N(    (   R   R   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR   ´   s    c         C   s   |  j  | ƒ S(   sê   
        Get whether the content is bounded (not a list).
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        @return: True if bounded, else False
        @rtype: boolean
        '(   R4   (   R   R   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyt   bounded¼   s    c         C   s   t  S(   sé   
        Get whether the object is unbounded (a list).
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        @return: True if unbounded, else False
        @rtype: boolean
        '(   t   False(   R   R   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR4   Æ   s    c         C   s   t  S(   sÞ   
        Get whether the object is nillable.
        @param content: The current content being unmarshalled.
        @type content: L{Content}
        @return: True if nillable, else False
        @rtype: boolean
        '(   R;   (   R   R   (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR%   Ð   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   R+   R   R   R   R   R   R:   R4   R%   (    (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyR
   !   s   			%									
	
N(    (   R>   t   loggingR    t   sudst   suds.umxt   suds.umx.attrlistR   t   suds.sax.textR   t   suds.sudsobjectR   R   R<   t   logR-   R
   (    (    (    sG   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/umx/core.pyt   <module>   s   

