[Checkins] SVN: grok/trunk/src/grok/ test that bogus templates aren't accepted

Philipp von Weitershausen philikon at philikon.de
Sun Oct 15 10:50:52 EDT 2006


Log message for revision 70655:
  test that bogus templates aren't accepted
  

Changed:
  U   grok/trunk/src/grok/_grok.py
  A   grok/trunk/src/grok/tests/view/inlinebogus.py

-=-
Modified: grok/trunk/src/grok/_grok.py
===================================================================
--- grok/trunk/src/grok/_grok.py	2006-10-15 14:49:21 UTC (rev 70654)
+++ grok/trunk/src/grok/_grok.py	2006-10-15 14:50:51 UTC (rev 70655)
@@ -97,7 +97,7 @@
         template = getattr(module, template_name, None)
         if template:
             if not_unicode_or_ascii(template):
-                raise GrokError("Invalid inline template %s for %r.  Inline "
+                raise GrokError("Invalid inline template '%s' for %r. Inline "
                                 "templates must be unicode or ASCII."
                                 % (template_name, factory))
             factory.template = GrokTemplate()

Added: grok/trunk/src/grok/tests/view/inlinebogus.py
===================================================================
--- grok/trunk/src/grok/tests/view/inlinebogus.py	2006-10-15 14:49:21 UTC (rev 70654)
+++ grok/trunk/src/grok/tests/view/inlinebogus.py	2006-10-15 14:50:51 UTC (rev 70655)
@@ -0,0 +1,27 @@
+# -*- coding: latin-1 -*-
+"""
+We do not accept bogus inline template such as ones that contain
+encoded strings:
+
+  >>> import grok
+  >>> grok.grok(__name__)
+  Traceback (most recent call last):
+    ...
+  GrokError: Invalid inline template 'cavepainting_pt' for <class 'grok.tests.view.inlinebogus.CavePainting'>. Inline templates must be unicode or ASCII.
+
+"""
+import grok
+
+class Mammoth(grok.Model):
+    pass
+
+class CavePainting(grok.View):
+    pass
+
+cavepainting_pt = """\
+<html>
+<body><h1 tal:content="string:Mammoth Cave Painting"/>
+<p>ööö</p>
+</body>
+</html>
+"""


Property changes on: grok/trunk/src/grok/tests/view/inlinebogus.py
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list