Commit 461cec96 authored by Evan Simpson's avatar Evan Simpson

Add indirection to macro access, so that derived classes can ensure that

the template is cooked.
parent 275b3389
......@@ -87,7 +87,7 @@
HTML- and XML-based template objects using TAL, TALES, and METAL.
"""
__version__='$Revision: 1.17 $'[11:-2]
__version__='$Revision: 1.18 $'[11:-2]
import os, sys, traceback, pprint
from TAL.TALParser import TALParser
......@@ -103,7 +103,7 @@ Z_DEBUG_MODE = os.environ.get('Z_DEBUG_MODE') == '1'
class MacroCollection(Base):
def __of__(self, parent):
return parent._v_macros
return parent.pt_macros()
class PageTemplate(Base):
"Page Templates using TAL, TALES, and METAL"
......@@ -174,6 +174,11 @@ class PageTemplate(Base):
def pt_warnings(self):
return self._v_warnings
def pt_macros(self):
if self._v_errors:
raise PTRuntimeError, 'Page Template %s has errors.' % self.id
return self._v_macros
def write(self, text):
assert type(text) is type('')
if text[:len(self._error_start)] == self._error_start:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment