summaryrefslogtreecommitdiff
path: root/src/zope/pagetemplate/interfaces.py
diff options
context:
space:
mode:
authorMalthe Borch <mborch@gmail.com>2011-09-13 11:15:39 +0000
committerMalthe Borch <mborch@gmail.com>2011-09-13 11:15:39 +0000
commit36e89981644e0ae93a52a1819ded849c9c524ff0 (patch)
tree4191de0435a6fdf38f6e946433dba044e4be6e52 /src/zope/pagetemplate/interfaces.py
parent0552c5d9c7495ee08d75e33e36137b114c5611c2 (diff)
downloadzope-pagetemplate-36e89981644e0ae93a52a1819ded849c9c524ff0.tar.gz
Fixed issue where a template would not have a ``_v_macros`` attribute.
This volatile attribute is relied upon by some legacy code such as the Zope 2 product ``PageTemplates``. In this changeset, the interface is changed to match that of the TAL parser's ``getCode`` method which returns a tuple ``(program, macros)``. These are in turn assigned to the volatile attributes ``_v_program`` and ``_v_macros``.
Diffstat (limited to 'src/zope/pagetemplate/interfaces.py')
-rw-r--r--src/zope/pagetemplate/interfaces.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/zope/pagetemplate/interfaces.py b/src/zope/pagetemplate/interfaces.py
index 19cbaf7..4929b39 100644
--- a/src/zope/pagetemplate/interfaces.py
+++ b/src/zope/pagetemplate/interfaces.py
@@ -113,23 +113,22 @@ class IPageTemplateEngine(Interface):
"""
def cook(source_file, text, engine, content_type):
- """Parse text and return prepared template program.
+ """Parse text and return prepared template program and macros.
Note that while ``source_file`` is provided to name the source
of the input ``text``, it should not be relied on to be an
actual filename (it may be an application-specific, virtual
path).
+
+ The return type is a tuple ``(program, macros)``.
"""
class IPageTemplateProgram(Interface):
"""Cooked template program."""
- macros = Attribute(
- "Template macros.")
-
def __call__(
- context, debug=0, wrap=60, metal=1, tal=1, showtal=-1,
+ context, macros, debug=0, wrap=60, metal=1, tal=1, showtal=-1,
strictinsert=1, stackLimit=100, i18nInterpolate=1,
sourceAnnotations=0):
"""Render template in the provided template ``context``.