[pypy-svn] r4908 - pypy/branch/src-newobjectmodel/pypy/tool/tb_server

mwh at codespeak.net mwh at codespeak.net
Fri Jun 4 15:41:31 CEST 2004


Author: mwh
Date: Fri Jun  4 15:41:30 2004
New Revision: 4908

Modified:
   pypy/branch/src-newobjectmodel/pypy/tool/tb_server/render.py
Log:
start rendering tracebacks for real


Modified: pypy/branch/src-newobjectmodel/pypy/tool/tb_server/render.py
==============================================================================
--- pypy/branch/src-newobjectmodel/pypy/tool/tb_server/render.py	(original)
+++ pypy/branch/src-newobjectmodel/pypy/tool/tb_server/render.py	Fri Jun  4 15:41:30 2004
@@ -1,9 +1,13 @@
 from pypy.tool.tb_server.server import TBRequestHandler
 from xpy import html, xml
+
+from std.magic import dyncode
+
 import traceback
 
-views = TBRequestHandler.views 
-###
+views = TBRequestHandler.views
+
+
 class TracebackView:
     def __init__(self, tb):
         self.name = 'traceback%d' % len(views) 
@@ -29,6 +33,18 @@
                 xml.escape(''.join(['Internal Rendering Error, traceback follows\n'] + lines)))
         
     def render_tb_really(self, args):
-        raise ValueError
+        lines = html.pre()
+        for tb in dyncode.listtb(self.tb):
+            filename = tb.tb_frame.f_code.co_filename 
+            lineno = tb.tb_lineno
+            name = tb.tb_frame.f_code.co_name
+            lines.append('  File "%s", line %d, in %s\n'%(
+                html.a(filename, href=filename).to_unicode().encode('utf-8'),
+                lineno, name))
+            lines.append(dyncode.getline(filename, lineno))
+        return lines
+            
+            
+            
             
                 



More information about the Pypy-commit mailing list