[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/pagetemplate/interfaces.py Merged from trunk 25973:

Jim Fulton jim at zope.com
Fri Jul 2 16:53:13 EDT 2004


Log message for revision 26073:
Merged from trunk 25973:
Added interfaces describing page template external and subclassing
interfaces.



-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/pagetemplate/interfaces.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/pagetemplate/interfaces.py	2004-07-02 20:52:02 UTC (rev 26072)
+++ Zope3/branches/ZopeX3-3.0/src/zope/pagetemplate/interfaces.py	2004-07-02 20:53:13 UTC (rev 26073)
@@ -17,7 +17,78 @@
 """
 from zope.interface import Interface, Attribute
 
-class IMacrosAttribute(Interface):
 
+class IPageTemplate(Interface):
+    """Objects that can render page templates
+    """
+
+    def __call__(*args, **kw):
+        """Render a page template
+
+        The argument handling is specific to particular
+        implementations.  Normally, however, positional arguments are
+        bound to the top-level `args` variable and keyword arguments
+        are bound to the top-level `options` variable.
+        """
+
+    def pt_edit(source, content_type):
+        """Set the source and content type
+        """
+
+    def read():
+        """Get the template source
+        """
+
     macros = Attribute("An object that implements the __getitem__ "
                        "protocol, containing page template macros.")
+
+class IPageTemplateSubclassing(IPageTemplate):
+    """Behavior that may be overridden or used by subclasses
+    """
+
+    
+    def pt_getContext(**kw):
+        """Compute a dictionary of top-level template names
+        
+        Responsible for returning the set of
+        top-level names supported in path expressions
+        
+        """
+
+    def pt_getEngine():
+        """Returns the TALES expression
+        """
+
+    def pt_getEngineContext(namespace):
+        """Return an execution context from the expression engine."""
+
+    def __call__(*args, **kw):
+        """Render a page template
+
+        This is sometimes overridden to provide additional argument
+        binding.
+        """
+        
+    def pt_source_file():
+        """return some text describing where a bit of ZPT code came from.
+
+        This could be a file path, a object path, etc.
+        """
+
+    def _cook():
+        """Compile the source
+
+        Results are saved in the variables: _v_errors, _v_warnings,
+        _v_program, and _v_macros, and the flag _v_cooked is set.
+        """
+    def _cook_check():
+        """Compiles the source if necessary
+
+        Subclasses might override this to influence the decision about
+        whether compilation is necessary.
+        """
+        
+    content_type = Attribute("The content-type of the generated output")
+
+    expand = Attribute(
+        "Flag indicating whether the read method should expand macros")



More information about the Zope3-Checkins mailing list