Ñò
 ĜqKc           @   s8  d  Z  d d d !Z d d d !Z d d d !Z d d k l Z d d	 k l Z d d
 k l	 Z	 d d k
 l Z d d k l Z d d k Z d d k Z d d k l Z l Z d d k l Z d d k l Z d d k l Z d Z d Z d Z d Z d Z d   Z d   Z d e e	 e f d     YZ e i  e  d S(   s$  
$RCSfile: XMLMethod.py,v $

ZopeXMLMethods provides methods to apply to Zope objects for XML/XSLT
processing.  XMLMethod is the base class for all ZopeXMLMethods.

Author: Craeg Strong <cstrong@arielpartners.com>
Release: 1.0

$Id: XMLMethod.py,v 1.1 2003/06/16 05:47:53 arielpartners Exp $
s	   $Name:  $i   iŝ˙˙˙s   $Date: 2003/06/16 05:47:53 $s   $Revision: 1.1 $i
   i˙˙˙˙(   t
   SimpleItem(   t   CatalogAware(   t   PropertyManager(   t
   IXMLMethod(   t   GeneratorRegistryN(   t   aq_baset	   aq_parent(   t   ClassSecurityInfo(   t   mapply(   t
   implementst   Viewt   Edits
   FTP accesss   Access contents informations   Manage XML Methodsc         C   s  t  |  } t | d  ok t | i d  oX | i i t i i j o? d } | i } x- | d j	 o | | i 7} | i } | SWn t | d  o | i	 d j	 o | | |  St | d  o$ | i
 d j	 o t | i
 d |  St |  o t |  Sd |  } t |   d S(	   s=   
    Get the result of an object as if it were published
    t   datat	   __class__t    t   __call__t
   index_htmls-   Error, unable to obtain source from object %sN(    (   R   t   hasattrR   R   t   OFSt   Imaget   Pdatat   Nonet   nextR   R   R   t   callablet   applyt	   Exception(   t   namet   objt   REQUESTt   baset   resultR   t   message(    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyt   getPublishedResult6   s$    #	 	
  
c         C   s
   t  i   S(   sJ   
    Return list of standard zope objects this Method can behave like
    (   R   t   supportedMetaTypes(   t   self(    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyt   behaveLikeListV   s    t	   XMLMethodc           B   sñ  e  Z d  Z e e  e   Z h d d 6d d 6d d 6h d d 6d d 6d d 6h d	 d 6d d 6d d 6h d
 d 6d d 6d d 6d d 6h d d 6d d 6d d 6d d 6h d d 6d d 6d d 6f Z e i	 i	 i
 e i i i
 Z
 d d  Z e i d  d   Z e i d  d   Z e i e d  d   Z e i d  d   Z e i d  d   Z e i d  d   Z e i d  d   Z e i e d   e i e d!  e i e d   d' d' d"  Z d# Z e i e d$  d%   Z d&   Z RS((   s,   
    Base class for all Zope XMLMethods
    t   titlet   idt   stringt   typet   wt   modet   descriptiont   textt   content_typet   selected_processort	   selectiont   availableProcessorst   select_variablet   behave_likeR#   t
   debugLevelt   inti    c         C   sC   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   N(   R&   R%   R+   R.   R-   R2   R3   (   R"   R&   R%   R+   R.   R-   R2   R3   (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyt   __init__   s    						c         C   s   t     d S(   s|   
        Return names of currently available processor libraries
        Derived classes must override this method.
        N(   t   NotImplementedError(   R"   (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyR0      s    t	   processorc         C   s   t     d S(   s|   
        Obtain the object encapsulating the selected processor.
        Derived classes must override this method.
        N(   R6   (   R"   (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyR7      s    t   getXmlSourceObjectc         C   sN   t  |   } x | i o t  |  } q W|  i   o d G| i   GHn | S(   sK   
        Retrieve the source object by using acquisition on the ID
        s   Requesting contents of(   R   t   isPrincipiaFolderisht   isDebuggingt   getId(   R"   t   ob(    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyR8   Ħ   s     
t   setDebugLevelc         C   s   | |  _  d S(   sb   
        Set debug level for ourselves and (eventually) our underlying
        processor.
        N(   R3   (   R"   t   value(    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyR=   ħ   s    R:   c         C   s   |  i  d j S(   s=   
        Return true if and only if debugging is on.
        i    (   R3   (   R"   (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyR:   ş   s    c         C   s
   t  i   S(   sR   
        Return list of standard zope objects this Method can behave like
        (   R   R!   (   R"   (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyR#   Á   s    t   getSelfc         C   s   |  i  d S(   s=   
        Return this object. For use in DTML scripts
        i    (   t   aq_chain(   R"   (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyR?   Ì   s    t	   AnonymousR   c         C   s   |  |  | |  S(   s²  
        Default view of rendered version of the results of XML
        process.  This is called when some one types the
        transformation path (e.g. "aSource/aMethod") directly into the
        browser, rather than via DTML or a page template.  We *must*
        use this method to pass the REQUEST parameter on, otherwise we
        wouldn't get it because _render_with_namespace_ is *not*
        called in this case.
        (    (   R"   R   t   RESPONSE(    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyR   Ŝ   s    
i   t   __render_with_namespace__c         C   s*   | d } | d } |  i  d | d |  S(   sô   
        Render with namespace namespace will be given to us by the ZPT
        that calls us, for example if a ZPT were to include something
        like the below:

        <div tal:replace="here/aSource/aXPathMethod">replaceme</div>
        R   RB   (   R   (   R"   t	   namespaceR   RB   (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyRC   ö   s    

c         C   s   d S(   sż   
        Repair this object.  This method is used for schema migration,
        when the class definition changes and existing instances of
        previous versions must be updated.
        N(    (   R"   (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyt   repair  s    N(   t   __name__t
   __module__t   __doc__R	   R   R   t	   _securityt   _propertiesR   R   t   manage_optionsR    R5   t   declarePublicR0   R7   t   declareProtectedt	   PERM_VIEWR8   R=   R:   R#   R?   t   setPermissionDefaultt   PERM_CONTENTR   R   t	   isDocTempRC   RE   (    (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyR$   c   sH   
							
		(!   RH   t
   __cvstag__t   __date__t   __version__t   OFS.SimpleItemR    t"   Products.ZCatalog.CatalogAwarenessR   t   OFS.PropertyManagerR   t
   interfacesR   R   R   t   Globalst   AcquisitionR   R   t   AccessControlR   t   ZPublisher.mapplyR   t   zope.interfaceR	   RN   t	   PERM_EDITt   PERM_FTPRP   t   PERM_MANAGER    R#   R$   t   InitializeClass(    (    (    s.   /srv/Zope/Products/ZopeXMLMethods/XMLMethod.pyt   <module>   s2   	 	Ğ