[bugzilla-gnome-org-extensions] Improve the short-stacking process for Python traces (include the module name) and also make the pop



commit 69a6722a83c3dc1a744bb9219be3342fb9059fdb
Author: Max Kanat-Alexander <mkanat everythingsolved com>
Date:   Sat Aug 8 22:18:36 2009 -0500

    Improve the short-stacking process for Python traces (include the module name)
    and also make the popular-traces display a little more readable.

 lib/TraceParser/Trace.pm                           |   13 +++++++++++++
 template/en/default/pages/popular-traces.html.tmpl |    6 +++++-
 web/style.css                                      |    4 ++++
 3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/lib/TraceParser/Trace.pm b/lib/TraceParser/Trace.pm
index 39e87a7..c1fcb12 100644
--- a/lib/TraceParser/Trace.pm
+++ b/lib/TraceParser/Trace.pm
@@ -28,6 +28,7 @@ use Bugzilla::Error;
 use Bugzilla::Util;
 use Scalar::Util qw(blessed);
 
+use File::Basename qw(basename dirname);
 use Parse::StackTrace;
 use Digest::MD5 qw(md5_base64);
 
@@ -361,6 +362,18 @@ sub _relevant_functions {
     my @relevant;
     foreach my $frame (@$frames) {
         my $function = $frame->function;
+        if ($frame->file
+            and $frame->isa('Parse::StackTrace::Type::Python::Frame'))
+        {
+            my $file = basename($frame->file);
+            if ($file eq '__init__.py') {
+                $file = basename(dirname($frame->file));
+            }
+            $file =~ s/.py$//i;
+            $function = ".$function" if $function;
+            $function = "$file$function";
+            
+        }
         if (!grep($_ eq $function, IGNORE_FUNCTIONS)) {
             $function =~ s/^IA__//;
             push(@relevant, $function);
diff --git a/template/en/default/pages/popular-traces.html.tmpl 
b/template/en/default/pages/popular-traces.html.tmpl
index 429baff..0665c05 100644
--- a/template/en/default/pages/popular-traces.html.tmpl
+++ b/template/en/default/pages/popular-traces.html.tmpl
@@ -32,7 +32,11 @@
       <a href="page.cgi?id=trace.html&amp;trace_id=
                [%- trace.id FILTER url_quote %]">
         [%- trace_count.${trace.id} FILTER html %]</a>:
-      [%+ trace.short_stack.join(", ") FILTER html %]</li>
+      [% FOREACH function = trace.short_stack %]
+        [% function FILTER html %]
+        [%- ' &rarr; ' UNLESS loop.last() %]
+      [% END ~%]
+    </li>
   [% END %]
 </ul>
 
diff --git a/web/style.css b/web/style.css
index 7ff6e6a..e6cf551 100644
--- a/web/style.css
+++ b/web/style.css
@@ -1,3 +1,7 @@
+.trace_list li {
+  margin-top: .3em;
+}
+
 .trace_link {
   margin-bottom: .5em;
   margin-top: -.5em;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]