[Checkins] SVN: Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/template.txt Added tests for template error handling.

Malthe Borch mborch at gmail.com
Mon Sep 22 12:05:21 EDT 2008


Log message for revision 91353:
  Added tests for template error handling.

Changed:
  U   Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/template.txt

-=-
Modified: Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/template.txt
===================================================================
--- Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/template.txt	2008-09-22 16:04:45 UTC (rev 91352)
+++ Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/template.txt	2008-09-22 16:05:20 UTC (rev 91353)
@@ -64,3 +64,32 @@
     </div>
   </html>  
   
+Error handling
+--------------
+
+When an exception is raised which does not expose a bug in the TAL
+translation machinery, we expect the exception to contain the part of
+the template source that caused the exception.
+
+Exception while evaluating expression:
+
+  >>> PageTemplate("""\
+  ... <div xmlns="http://www.w3.org/1999/xhtml"
+  ...      xmlns:tal="http://xml.zope.org/namespaces/tal">
+  ...   <span tal:content="range()" />
+  ... </div>""").render()
+  Traceback (most recent call last):
+    ...
+  TypeError: range expected at least 1 arguments, got 0
+
+Exception while evaluating definition:
+
+  >>> PageTemplate("""\
+  ... <div xmlns="http://www.w3.org/1999/xhtml"
+  ...      xmlns:tal="http://xml.zope.org/namespaces/tal">
+  ...   <span tal:define="dummy range()" />
+  ... </div>""").render()
+  Traceback (most recent call last):
+    ...
+  TypeError: range expected at least 1 arguments, got 0
+



More information about the Checkins mailing list