Commit 6f90058b authored by Evan Simpson's avatar Evan Simpson

Subclass RuntimeError to allow it to be distinguished from Python problems.

parent d3458376
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
HTML- and XML-based template objects using TAL, TALES, and METAL. HTML- and XML-based template objects using TAL, TALES, and METAL.
""" """
__version__='$Revision: 1.16 $'[11:-2] __version__='$Revision: 1.17 $'[11:-2]
import os, sys, traceback, pprint import os, sys, traceback, pprint
from TAL.TALParser import TALParser from TAL.TALParser import TALParser
...@@ -144,7 +144,7 @@ class PageTemplate(Base): ...@@ -144,7 +144,7 @@ class PageTemplate(Base):
def pt_render(self, source=0, extra_context={}): def pt_render(self, source=0, extra_context={}):
"""Render this Page Template""" """Render this Page Template"""
if self._v_errors: if self._v_errors:
raise RuntimeError, 'Page Template %s has errors.' % self.id raise PTRuntimeError, 'Page Template %s has errors.' % self.id
output = StringIO() output = StringIO()
c = self.pt_getContext() c = self.pt_getContext()
c.update(extra_context) c.update(extra_context)
...@@ -235,3 +235,7 @@ class _ModuleImporter: ...@@ -235,3 +235,7 @@ class _ModuleImporter:
return mod return mod
ModuleImporter = _ModuleImporter() ModuleImporter = _ModuleImporter()
class PTRuntimeError(RuntimeError):
'''The Page Template has template errors that prevent it from rendering.'''
pass
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