[Rt-commit] rt branch, 4.0/dashboard-mailer-dummy-error_headers_out, created. rt-4.0.8rc1-2-g92ee5cf

Kevin Falcone falcone at bestpractical.com
Mon Oct 15 12:44:13 EDT 2012


The branch, 4.0/dashboard-mailer-dummy-error_headers_out has been created
        at  92ee5cfe705a4a9e59d5c70b7f1b21dee04c9900 (commit)

- Log -----------------------------------------------------------------
commit 4917b613332160df0eda63fd59d83c5df8ed42f5
Author: Tim Cutts <tjrc at sanger.ac.uk>
Date:   Fri Oct 12 10:59:51 2012 +0100

    err_headers_out method for fake web request object
    
    RT::Extension::ActivityReports makes a call which requires the fake web
    request object to implement this method.  [rt3 #20871]

diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 40b53b1..0257525 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -562,6 +562,7 @@ sub GetResource {
     sub new { bless {}, shift }
     sub header_out { shift }
     sub headers_out { shift }
+    sub err_headers_out { shift }
     sub content_type {
         my $self = shift;
         $self->{content_type} = shift if @_;

commit 92ee5cfe705a4a9e59d5c70b7f1b21dee04c9900
Author: Tim Cutts <tjrc at sanger.ac.uk>
Date:   Fri Oct 12 11:02:20 2012 +0100

    Make fake web request methods safer
    
    The fake methods were returning the object instance itself, rather than
    a data type compatible with what the real object does.  While this does
    not cause any bugs at this point, it could lead to unexpected
    consequences in the future; for example anything calling headers_out in
    an array context would break, even though it's a valid thing to do.

diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 0257525..1c8070f 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -560,9 +560,9 @@ sub GetResource {
 {
     package RT::Dashboard::FakeRequest;
     sub new { bless {}, shift }
-    sub header_out { shift }
-    sub headers_out { shift }
-    sub err_headers_out { shift }
+    sub header_out { return undef }
+    sub headers_out { wantarray ? () : {} }
+    sub err_headers_out { wantarray ? () : {} }
     sub content_type {
         my $self = shift;
         $self->{content_type} = shift if @_;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list