[ZPT] CVS: Releases/Zope/lib/python/Products/PageTemplates - PageTemplate.py:1.18

Evan Simpson evan@zope.com
Thu, 15 Nov 2001 11:33:52 -0500


Update of /cvs-repository/Releases/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv18855

Modified Files:
	PageTemplate.py 
Log Message:
Add indirection to macro access, so that derived classes can ensure that
the template is cooked.

=== Releases/Zope/lib/python/Products/PageTemplates/PageTemplate.py 1.17 => 1.18 ===
 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"
@@ -173,6 +173,11 @@
         
     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('')