[Checkins] SVN: z3c.pt/trunk/ Get rid of safe_render.

Chris McDonough chrism at plope.com
Wed Aug 20 12:09:58 EDT 2008


Log message for revision 90028:
  Get rid of safe_render.
  

Changed:
  U   z3c.pt/trunk/CHANGES.txt
  U   z3c.pt/trunk/src/z3c/pt/template.py

-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt	2008-08-20 15:51:55 UTC (rev 90027)
+++ z3c.pt/trunk/CHANGES.txt	2008-08-20 16:09:57 UTC (rev 90028)
@@ -4,6 +4,9 @@
 Version 1.0dev
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+- Remove ``safe_render`` implementation detail.  It hid information
+  in tracebacks. [chrism]
+
 - Fixed a few more UnicodeDecodeErrors (test contributed by Wiggy).
   In particular, never upcast to unicode during transformation, and
   utf-8 encode Unicode attribute keys and values in Assign expressions

Modified: z3c.pt/trunk/src/z3c/pt/template.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/template.py	2008-08-20 15:51:55 UTC (rev 90027)
+++ z3c.pt/trunk/src/z3c/pt/template.py	2008-08-20 16:09:57 UTC (rev 90028)
@@ -78,40 +78,8 @@
         # pass in selectors
         kwargs.update(self.selectors)
 
-        if PROD_MODE:
-            return template(**kwargs)
+        return template(**kwargs)
 
-        return self.safe_render(template, **kwargs)
-
-    def safe_render(self, template, **kwargs):
-        try:
-            return template(**kwargs)
-        except Exception, e:
-            __traceback_info__ = getattr(e, '__traceback_info__', None)
-            if __traceback_info__ is not None:
-                raise e
-            
-            etype, value, tb = sys.exc_info()
-            lineno = tb.tb_next.tb_lineno-1
-            annotations = self.annotations
-
-            while lineno >= 0:
-                if lineno in annotations:
-                    annotation = annotations.get(lineno)
-                    break
-
-                lineno -= 1
-            else:
-                annotation = "n/a"
-
-            e.__traceback_info__ = "While rendering %s, an exception was "\
-                                   "raised evaluating ``%s``:\n\n" % \
-                                   (repr(self), str(annotation))
-            
-            e.__traceback_info__ += "".join(traceback.format_tb(tb))
-            
-            raise e
-
     def __call__(self, **kwargs):
         return self.render(**kwargs)
 



More information about the Checkins mailing list