[Checkins] SVN: grokcore.view/trunk/src/grokcore/view/templatereg.py More helpful errors for obvious errors

Patrick Gerken do3ccqrv at gmail.com
Sun Sep 18 19:27:31 EST 2011


Log message for revision 122831:
  More helpful errors for obvious errors
  

Changed:
  U   grokcore.view/trunk/src/grokcore/view/templatereg.py

-=-
Modified: grokcore.view/trunk/src/grokcore/view/templatereg.py
===================================================================
--- grokcore.view/trunk/src/grokcore/view/templatereg.py	2011-09-17 08:40:32 UTC (rev 122830)
+++ grokcore.view/trunk/src/grokcore/view/templatereg.py	2011-09-19 00:27:30 UTC (rev 122831)
@@ -157,9 +157,16 @@
             # Warning when importing files. This should be
             # allowed because people may be using editors that generate
             # '.bak' files and such.
-            warnings.warn("File '%s' has an unrecognized extension in "
-                          "directory '%s'" %
-                          (template_file, template_dir), UserWarning, 2)
+            if extension == 'pt':
+                warnings.warn("You forgot to embed the zcml slug for "
+                              "grokcore.view. It provides a renderer "
+                              "for pt files. Now the file '%s' in '%s' "
+                              "cannot be rendered" %
+                              (template_file, template_dir), UserWarning, 2)
+            else:
+                warnings.warn("File '%s' has an unrecognized extension in "
+                              "directory '%s'" %
+                              (template_file, template_dir), UserWarning, 2)
             return
         template = template_factory(template_file, template_dir)
         template._annotateGrokInfo(template_name, template_path)



More information about the checkins mailing list