Ticket #4786: views_debug_py.2.diff

File views_debug_py.2.diff, 1.4 KB (added by Thomas Güttler <hv@…>, 8 years ago)

Better patch.

  • views/debug.py

     
    103103        module_name = tb.tb_frame.f_globals.get('__name__')
    104104        pre_context_lineno, pre_context, context_line, post_context = _get_lines_from_file(filename, lineno, 7, loader, module_name)
    105105        if pre_context_lineno is not None:
     106            mycode=not re.search(
     107                r'site-packages/|lib.?.?/python|'
     108                r'django/(contrib|core|db|dispatch|(new|old)?forms|http|middleware|shortcuts|template(tags)?|test|utils|views)/',
     109                filename) # Display my files bigger and python/django files smaller.
    106110            frames.append({
    107111                'tb': tb,
    108112                'filename': filename,
     113                'mycode': mycode,
    109114                'function': function,
    110115                'lineno': lineno + 1,
    111116                'vars': tb.tb_frame.f_locals.items(),
     
    401406    <ul class="traceback">
    402407      {% for frame in frames %}
    403408        <li class="frame">
    404           <code>{{ frame.filename|escape }}</code> in <code>{{ frame.function|escape }}</code>
     409          <code style="font-size: {% if frame.mycode %}x-large{% else %}medium{% endif %}">{{ frame.filename|escape }}</code> in
     410          <code>{{ frame.function|escape }}</code>
    405411
    406412          {% if frame.context_line %}
    407413            <div class="context" id="c{{ frame.id }}">
Back to Top