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

Bug#728708: ben: breaks if template defines buildds or critical_bugs to return None



Package: ben
Version: 0.6.6
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch trusty

ben tries to handle the case where a template has no meaningful way to
define buildds or critical_bugs and so simply defines them to return
None (as is the case for Ubuntu): it raises Exit and catches it in the
definition of column_arg.  Unfortunately, when I tried this, it doesn't
actually work; it looks as though buildd_link and rc_bugs_link are
evaluated outside the try block.  This patch works for me.

  * Tolerate templates with buildds or critical_bugs entries that return
    None.

=== modified file 'frontends/ben_monitor.ml'
--- frontends/ben_monitor.ml	2013-11-04 12:46:10 +0000
+++ frontends/ben_monitor.ml	2013-11-04 14:31:20 +0000
@@ -492,16 +492,17 @@ let print_html_monitor template sources
           )
         :: acc
       end ([], rows) (List.rev xs)) in
-      let buildd_link =
-        if names = []
-        then small [ pcdata "arch:all" ]
-        else buildds template true (List.map escape names) in
-      let rc_bugs_link = rc_bugs template (List.map escape names) in
-      let column_arg = try [
-        pcdata " (";
-        buildd_link; pcdata " "; rc_bugs_link;
-        pcdata ")"
-      ]
+      let column_arg = try
+        let buildd_link =
+          if names = []
+          then small [ pcdata "arch:all" ]
+          else buildds template true (List.map escape names) in
+        let rc_bugs_link = rc_bugs template (List.map escape names) in
+        [
+          pcdata " (";
+          buildd_link; pcdata " "; rc_bugs_link;
+          pcdata ")"
+        ]
         with Exit -> []
       in
       archs_columns i

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


Reply to: