Ñò
ÁØqKc           @   sÅ   d  Z  d d d !Z d d d !Z d d d !Z d d k l Z d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d e f d „  ƒ  YZ
 d e f d „  ƒ  YZ d S(   s¯   
$RCSfile: interfaces.py,v $

Processor interfaces

Author: Philipp von Weitershausen <philikon@philikon.de>

$Id: interfaces.py,v 1.4 2005/09/06 02:08:59 arielpartners Exp $
s	   $Name:  $i   iþÿÿÿs   $Date: 2005/09/06 02:08:59 $s   $Revision: 1.4 $i
   iÿÿÿÿ(   t	   Interfacet
   IProcessorc           B   s   e  Z d  „  Z RS(   c         C   s   d S(   s‹   

        Set debug level from 0 to 3.
        0 = silent
        3 = extra verbose
        Debug messages go to Zope server log.

        N(    (   t   level(    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   setDebugLevel   s    (   t   __name__t
   __module__R   (    (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyR      s   t   IDTDValidatorc           B   s    e  Z d  Z d „  Z d „  Z RS(   sÓ  
    ZopeXMLMethods DTD Validator public interface

    This class encapsulates an DTD Validator for use by
    ZopeXMLMethods.  IDTDValidator is the Interface implemented by a
    processor library.  Any library capable of validating XML via a
    DTD can be used, as long as an adaptor class is written that
    conforms to this interface.

    This is the first of many schema validator interfaces.  For
    example: XML-Schema, RelaxNG, Schematron, DTD.
    
    c         C   s   d S(   sm   
        Validate the passed in XML document against the
        DTD that it refers to in a DOCTYPE.
        N(    (   t	   xmlStringt   xmlURL(    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   dtdValidationResultsString,   s    c         C   s   d S(   so   
        Return boolean indicating whether passed in document is valid
        with respect to its DTD
        N(    (   R   R   (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   isValidForDTD2   s    (   R   R   t   __doc__R	   R
   (    (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyR      s   	t   IXPathProcessorc           B   s   e  Z d  Z d „  Z RS(   sU  
    ZopeXMLMethods XSLT Processor public interface

    This class encapsulates an XSLT Processor for use by
    ZopeXMLMethods.  IXSLTProcessor is the Interface implemented by a
    processor library.  Any library capable of processing XPath can be
    used, as long as an adaptor class is written that conforms to this
    interface.
    c         C   s   d S(   sy  
        Return compiled expression as IXPathExpression.  If a
        particular processing library does not provide the capability
        of compiling an expression, it may choose to implement
        IXPathExpression directly and have this method return an
        instance of itself (see SabPythProcessor.py).  Throws an exception
        if there are any errors.
        N(    (   t
   expression(    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   compileC   s    (   R   R   R   R   (    (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyR   8   s   	t   IXPathExpressionc           B   s#   e  Z d  Z d d „ Z d „  Z RS(   sî   
    
    Interface for a compiled xpath expression.  This may be
    implemented either as a separate adaptor class that adapts a
    processor-native compiled xpath expression type, or directly by
    the parent adaptor class.
    
    i    c         C   s   d S(   s+   return result of xpath evaluation as stringN(    (   R   R   t   prettyPrint(    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   evaluateStringW   s    c         C   s   d S(   s)   return a list of DOM nodes matching xpathN(    (   t   xmlNodeR   (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   evaluateDOMZ   s    (   R   R   R   R   R   (    (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyR   M   s   t   IXSLTProcessorc           B   s    e  Z d  Z d h  d d „ Z RS(   sT  
    ZopeXMLMethods XSLT Processor public interface

    This class encapsulates an XSLT Processor for use by
    ZopeXMLMethods.  IXSLTProcessor is the Interface implemented by a
    processor library.  Any library capable of processing XSLT can be
    used, as long as an adaptor class is written that conforms to this
    interface.
    c         C   s   d S(   s¨  
        Transforms the passed in XML into the required output (usually
        HTML) using the passed in XSLT.  Both the XML and XSLT strings
        should be well-formed.  Returns the output as a string.
        transformObject and REQUEST params may be used to acquire Zope
        content such as XSLT parameters and URN namespaces, if
        required.

        If anything goes wrong, it raises an Exception.
        N(    (   R   R   t
   xsltStringt   xsltURLt   transformObjectt
   xsltParamst   REQUEST(    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt	   transformh   s    N(   R   R   R   t   NoneR   (    (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyR   ]   s   	t   IProcessorRegistryc           B   sA   e  Z d  d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   i    c         C   s   d S(   sf  
        For a given processor type, indicate a preference for one
        processor over another.  Set the 'exclusive' flag to indicate
        that no other choices should be offered, even if available.
        To change your preference, simply call this method again.
        
        Note: if the chosen processor is not available, this advice is
        simply ignored.  Why?  Imagine the case where you make a
        choice, then ZSync the object tree to another Zope instance in
        which this processor is not available!  We must recover
        gracefully from this (rather likely) scenario.
        N(    (   t   processorTypet   processorNamet	   exclusive(    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   preferw   s    c         C   s   d S(   s6   register a processor with the given name and classnameN(    (   R   R   t   processorClassName(    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   register…   s    c         C   s   d S(   se  
        
        Return list of currently available processors of the given
        type.

        If an exclusive preference has been expressed, *and* the
        preferred processor is available, return only that.

        Call reload() first to ensure we pick up new processor
        libraries if we just got ZSynced to another Zope instance.

        N(    (   R   (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   namesˆ   s    c         C   s   d S(   s³   
        
        Obtain the object encapsulating the named processor of the
        given type, if it is available.

        Otherwise, return the defaultItem()
        
        N(    (   R   R   (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   item–   s    c         C   s   d S(   s“  

        Obtain the object encapsulating the preferred processor of the
        given type, if it is available.

        Otherwise try all other processors in random order.

        Finally, give up if we don't have a single processor
        available.

        Call reload() first to ensure we pick up new processor
        libraries if we just got ZSynced to another Zope instance.
        
        N(    (   R   (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   defaultItem    s    c         C   s   d S(   sï   
        
        Return the name of the default processor of the indicated
        type.  If a preference was indicated and it is available, return
        it.  Otherwise return the first one or None if there aren't
        any.

        N(    (   R   (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   defaultName°   s    (   R   R   R    R"   R#   R$   R%   R&   (    (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyR   u   s   			
	N(   R   t
   __cvstag__t   __date__t   __version__t   zope.interfaceR    R   R   R   R   R   R   (    (    (    s:   /srv/Zope/Products/ZopeXMLMethods/processors/interfaces.pyt   <module>	   s   