You are not logged in Log in Join
You are here: Home » Members » Tino Wildenhain » Improve traceback display with code excerpt and highlighting » Visual Traceback - code highlighter in traceback » View NewsItem

Log in
Name

Password

 

Visual Traceback - code highlighter in traceback

This product patches the traceback formatting to enable context cites and - if enscript is installed at start time - syntax highlighting of the excerpt sources too.

This product can be found here.

don't forget to install enscript before you restart zope since it will only use it for syntax highlighting if found on start


Example Traceback with product and enscript installed

Time 2005/07/14 11:53:22.225 GMT+2
User Name (User Id) tino (tino)
Request URL http://testserver/tracetest
Exception Type ZeroDivisionError
Exception Value integer division or modulo by zero

Traceback (innermost last):

  • 
    Module ZPublisher.Publish, line 113, in publish
    111 |                      missing_name,
    112 |                      dont_publish_class,
    113>|                      request, bind=1)
    114 |
    115 |        if result is not response:
    
    
    
  • 
    Module ZPublisher.mapply, line 88, in mapply
    086 |
    087 |    args=tuple(args)
    088>|    if debug is not None: return debug(object,args,context)
    089 |    else: return object(*args)
    
    
    
  • 
    Module ZPublisher.Publish, line 40, in call_object
    038 |
    039 |def call_object(object, args, request):
    040>|    result=apply(object,args) # Type s<cr> to step into published object.
    041 |    return result
    042 |
    
    
    
  • 
    Module Shared.DC.Scripts.Bindings, line 311, in __call__
    309 |    def __call__(self, *args, **kw):
    310 |        '''Calls the script.'''
    311>|        return self._bindAndExec(args, kw, None)
    312 |
    313 |    def __render_with_namespace__(self, namespace):
    
    
    
  • 
    Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
    346 |                exec bindcode
    347 |                bound_data = bound_data[0]
    348>|            return self._exec(bound_data, args, kw)
    349 |        finally:
    350 |            security.removeContext(self)
    
  • 
    Module Products.PythonScripts.PythonScript, line 323, in _exec
    321 |        f = new.function(fcode, g, None, fadefs)
    322 |
    323>|        result = f(*args, **kw)
    324 |        if keyset is not None:
    325 |            # Store the result in the cache.
    
    
  • 
    Module None, line 13, in tracetest
    <b>&lt;PythonScript at /Templates/tracetest&gt;</b><b>Line 13</b>
    010 |    print "(%s)" % html_quote(script.title),
    011 |print "in", container.absolute_url()
    012>|print "foo %d" % (1/0)
    013 |return printed
    014 |
ZeroDivisionError: integer division or modulo by zero