Ben Bangert avatar Ben Bangert committed b78d1b8 Merge

merge

Comments (0)

Files changed (7)

 WebError Changelog
 ==================
 
+0.10.1 (12/29/2008)
+* Fix view source when __file__ is .pyo or $py.class.
+
 0.10 (12/18/2008)
-* Fixed syntax highlighting.
+* Fix indentation of code lines in the traceback view.
+* Enable syntax highlighting in view source.
 * Fix a case where the response could become unicode; fix the docstring
   patching when using python -O
 
 from setuptools import setup, find_packages
 import sys, os
 
-version = '0.10'
+version = '0.10.1'
 
 setup(name='WebError',
       version=version,

weberror/eval-media/debug.js

     el.className = "active";
     var el = document.getElementById(id+'_tab');
     el.className = "active";
+
+    return false;
 }
 
 function hide_display(id) {

weberror/eval-media/traceback.css

 div.feature-highlight{
     width: 550px;
     background: #eee;
-    margin-top: 50px;
-    padding: 5px 10px 5px 10px;
+    margin-top: 0px;
+    padding: 12px 15px 15px 15px;
+    border-bottom: 1px solid #ccc;
+    border-right: 1px solid #ddd;
 }
 
 /* Horizontal Rule */
 
 h1.first{
     margin-top: 0px;
-    margin-bottom: 2px;
+    margin-bottom: 0px;
     border-bottom: 1px solid #666;
     background: #fFF;
     padding: 3px;
     color: #000000;
 }
 
+.main-exception-bar {
+    background: #f8f8f8;
+    border-bottom: 1px solid #ccc;
+    padding: 10px 0px;
+    margin-bottom: 17px;
+}
 .main-exception {
     font-size: 200%;
 }
+span.main-exception {
+    margin-left: 19px;
+    margin-right: 10px;
+}
+code.main-exception {
+}
 
 /* Boxes */
 
 #formats {
-    margin: 0 0 12px 14px;
+    margin: -17px 4px 4px 5px;
     font-size: 11px;
     color: #888;
     float: right;
 }
 
 tr.even {
-  background-color: #ddd;
+  background-color: #e8e8e8;
 }
 
 table.variables td {

weberror/eval_template.html

 
             <ul id="navlist">
                <!--  {{#links|html}} -->
-               <li id="source_data_tab"><a href="#source_data" onclick="javascript:switch_display('source_data')" accesskey="4" id="source_data_link">Source</a></li>
-               <li id="template_data_tab"><a href="#template_data" onclick="javascript:switch_display('template_data')" accesskey="3" id="template_data_link">Template</a></li>
-               <li id="extra_data_tab"><a href="#extra_data" onclick="javascript:switch_display('extra_data')" id="extra_data_link" accesskey="2" >Extra Data</a></li>
-               <li id="traceback_data_tab" class="active"><a href="#traceback_data" onclick="javascript:switch_display('traceback_data')" id="traceback_data_link" class="active" accesskey="1">Traceback</a></li>
+               <li id="source_data_tab"><a href="#source_data" onclick="javascript:return switch_display('source_data');" accesskey="4" id="source_data_link">Source</a></li>
+               <li id="template_data_tab"><a href="#template_data" onclick="javascript:return switch_display('template_data');" accesskey="3" id="template_data_link">Template</a></li>
+               <li id="extra_data_tab"><a href="#extra_data" onclick="javascript:return switch_display('extra_data');" id="extra_data_link" accesskey="2" >Extra Data</a></li>
+               <li id="traceback_data_tab" class="active"><a href="#traceback_data" onclick="javascript:return switch_display('traceback_data');" id="traceback_data_link" class="active" accesskey="1">Traceback</a></li>
             </ul>
     </div>
     <div id="main-content">
             </div>
             <div id="traceback_data">
 <div style="float: left; width: 100%; padding-bottom: 20px;">
-<h1 class="first"><a name="content"></a>Error Traceback:</h1>
+<h1 class="first"><a name="content"></a>WebError Traceback:</h1>
+<div class="main-exception-bar">
+  <span class="main-exception" style="color: #f00;">&#8669;</span>
+  <code class="main-exception">{{exc_name}}: {{formatted_exc_value|html}}</code>
+</div>
 <div id="formats">
    <span class="title">View as: &nbsp;</span> <a id="view_short_html" class="active" href="#">Interactive</a> 
    <a id="view_long_html" href="#">(full)</a> &nbsp;|&nbsp; <a id="view_short_text" href="#">Text</a>  
    <a id="view_long_text" href="#">(full)</a> &nbsp;|&nbsp; <a id="view_short_xml" href="#">XML</a> 
    <a id="view_long_xml" href="#">(full)</a>
-</div>
-<div><span class="main-exception" style="color: #f00;">&#8669;</span>
-  <code class="main-exception">{{exc_name}}: {{formatted_exc_value|html}}</code></div>
+</div>  
 <div style="clear: both;">
 <div id="error-area" style="display: none; background-color: #600; color: #fff; border: 2px solid black">
 <button onclick="return clearError()">clear this</button>

weberror/evalexception.py

             res.body = 'The module <code>%s</code> does not have an entry in sys.modules' % module_name
             return res
         filename = module.__file__
-        if filename.endswith('.pyc'):
+        if filename[-4:] in ('.pyc', '.pyo'):
             filename = filename[:-1]
+        elif filename.endswith('$py.class'):
+            filename = '%s.py' % filename[:-9]
         f = open(filename, 'rb')
         source = f.read()
         f.close()

weberror/formatter.py

     if not lexer:
         lexer = TextLexer()
     formatter = HtmlFormatter(linenos=linenos, lineanchors=lineanchors,
-                              cssclass=cssclass, classprefix='highlight. ')
+                              cssclass=cssclass)
     return pygments_highlight(code, lexer, formatter)
 
 class AbstractFormatter(object):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.