[Zope3-checkins]
SVN: Zope3/trunk/src/zope/pagetemplate/interfaces.py
Added interfaces describing page template external and subclassing
Jim Fulton
jim at zope.com
Thu Jun 24 17:31:11 EDT 2004
Log message for revision 25973:
Added interfaces describing page template external and subclassing
interfaces.
-=-
Modified: Zope3/trunk/src/zope/pagetemplate/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/pagetemplate/interfaces.py 2004-06-24 21:30:39 UTC (rev 25972)
+++ Zope3/trunk/src/zope/pagetemplate/interfaces.py 2004-06-24 21:31:11 UTC (rev 25973)
@@ -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