Ticket #11834: 11834_green_yellow.patch

File 11834_green_yellow.patch, 2.8 KB (added by Yuri Baburov, 15 years ago)
  • django/views/debug.py

    diff --git a/django/views/debug.py b/django/views/debug.py
    index fe44e25..4dfa723 100644
    a b class ExceptionReporter:  
    221221            function = tb.tb_frame.f_code.co_name
    222222            lineno = tb.tb_lineno - 1
    223223            loader = tb.tb_frame.f_globals.get('__loader__')
    224             module_name = tb.tb_frame.f_globals.get('__name__')
     224            module_name = tb.tb_frame.f_globals.get('__name__') or ''
    225225            pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
    226226            if pre_context_lineno is not None:
    227227                frames.append({
    228228                    'tb': tb,
     229                    'type': module_name.startswith('django.') and 'django' or 'user',
    229230                    'filename': filename,
    230231                    'function': function,
    231232                    'lineno': lineno + 1,
    TECHNICAL_500_TEMPLATE = """  
    333334    table.source th { color:#666; }
    334335    table.source td { font-family:monospace; white-space:pre; border-bottom:1px solid #eee; }
    335336    ul.traceback { list-style-type:none; }
    336     ul.traceback li.frame { margin-bottom:1em; }
     337    ul.traceback li.frame { padding-bottom:1em; }
     338    ul.traceback li.django { background-color: #ffe;}
     339    ul.traceback li.user { background-color: #ffe;}
    337340    div.context { margin: 10px 0; }
    338341    div.context ol { padding-left:30px; margin:0 10px; list-style-position: inside; }
    339342    div.context ol li { font-family:monospace; white-space:pre; color:#666; cursor:pointer; }
    340     div.context ol.context-line li { color:black; background-color:#ccc; }
     343    div.context ol.context-line li { color:black; background-color:#fcc; }
     344    .django div.context ol.context-line li { background-color:#cfc; }
     345    .user div.context ol.context-line li { background-color:#fec; }
    341346    div.context ol.context-line li span { float: right; }
    342347    div.commands { margin-left: 40px; }
    343348    div.commands a { color:black; text-decoration:none; }
    TECHNICAL_500_TEMPLATE = """  
    347352    #template, #template-not-exist { background:#f6f6f6; }
    348353    #template-not-exist ul { margin: 0 0 0 20px; }
    349354    #unicode-hint { background:#eee; }
    350     #traceback { background:#eee; }
     355    #traceback { background:#ffe; }
    351356    #requestinfo { background:#f6f6f6; padding-left:120px; }
    352357    #summary table { border:none; background:transparent; }
    353358    #requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; }
    TECHNICAL_500_TEMPLATE = """  
    504509  <div id="browserTraceback">
    505510    <ul class="traceback">
    506511      {% for frame in frames %}
    507         <li class="frame">
     512        <li class="frame {{ frame.type }}">
    508513          <code>{{ frame.filename|escape }}</code> in <code>{{ frame.function|escape }}</code>
    509514
    510515          {% if frame.context_line %}
Back to Top