[Rt-commit] r13700 - in rt/3.8/trunk: . share/html/Dashboards t/web

sartak at bestpractical.com sartak at bestpractical.com
Mon Jun 30 18:49:14 EDT 2008


Author: sartak
Date: Mon Jun 30 18:49:11 2008
New Revision: 13700

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/lib/RT/SharedSetting.pm
   rt/3.8/trunk/share/html/Dashboards/Modify.html
   rt/3.8/trunk/t/web/dashboards.t

Log:
 r63493 at onn:  sartak | 2008-06-30 18:48:48 -0400
 Better "unable to load dashboard" errors


Modified: rt/3.8/trunk/lib/RT/SharedSetting.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/SharedSetting.pm	(original)
+++ rt/3.8/trunk/lib/RT/SharedSetting.pm	Mon Jun 30 18:49:11 2008
@@ -114,7 +114,7 @@
         } else {
             $RT::Logger->error("Could not load attribute " . $id
                     . " for object " . $privacy);
-            return (0, $self->loc("[_1] attribute load failure", ucfirst($self->ObjectName)));
+            return (0, $self->loc("Failed to load [_1] [_2]", $self->ObjectName, $id))
         }
     } else {
         $RT::Logger->warning("Could not load object $privacy when loading " . $self->ObjectName);
@@ -135,8 +135,10 @@
     my $id   = shift;
 
     my $attr = RT::Attribute->new($self->CurrentUser);
-    unless ($attr->LoadById($id)) {
-        return (0, $self->loc("Failed to load attribute [_1]", $id))
+    my ($ok, $msg) = $attr->LoadById($id);
+
+    if (!$ok) {
+        return (0, $self->loc("Failed to load [_1] [_2]: [_3]", $self->ObjectName, $id, $msg))
     }
 
     my $privacy = $self->_build_privacy($attr->ObjectType, $attr->ObjectId);

Modified: rt/3.8/trunk/share/html/Dashboards/Modify.html
==============================================================================
--- rt/3.8/trunk/share/html/Dashboards/Modify.html	(original)
+++ rt/3.8/trunk/share/html/Dashboards/Modify.html	Mon Jun 30 18:49:11 2008
@@ -90,7 +90,6 @@
 
 Abort(loc("Permission denied")) if @privacies == 0;
 
-
 # user went directly to Modify.html
 $Create = 1 if !$id;
 
@@ -116,7 +115,7 @@
     }
     else {
         my ($ok, $msg) = $Dashboard->LoadById($id);
-        $ok || Abort(loc("Couldn't load dashboard [_1]: [_2]", $id, $msg));
+        $ok || Abort($msg);
     }
 
     if ($id) {

Modified: rt/3.8/trunk/t/web/dashboards.t
==============================================================================
--- rt/3.8/trunk/t/web/dashboards.t	(original)
+++ rt/3.8/trunk/t/web/dashboards.t	Mon Jun 30 18:49:11 2008
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use Test::More tests => 76;
+use Test::More tests => 77;
 use RT::Test;
 my ($baseurl, $m) = RT::Test->started_ok;
 
@@ -175,4 +175,5 @@
 
 $m->get("/Dashboards/Modify.html?id=$id");
 $m->content_lacks("different dashboard", "dashboard was deleted");
+$m->content_contains("Failed to load dashboard $id");
 


More information about the Rt-commit mailing list