[Rt-commit] rt branch, 4.0/remove-mailgate-html-error-deps, created. rt-4.0.4-233-gd8a4a6a

Thomas Sibley trs at bestpractical.com
Wed Jan 25 13:17:06 EST 2012


The branch, 4.0/remove-mailgate-html-error-deps has been created
        at  d8a4a6ad66a2f8ba0b39f337fb51c360fc5259e7 (commit)

- Log -----------------------------------------------------------------
commit d8a4a6ad66a2f8ba0b39f337fb51c360fc5259e7
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Jan 25 12:51:37 2012 -0500

    Remove HTML::TreeBuilder and HTML::FormatText from rt-mailgate's deps
    
    They are still required by core RT.
    
    HTTP::Response->error_as_HTML has always been a method that returns
    static, predictable HTML based on the HTTP response code.  There is no
    reason to parse it with a full blown HTML parser just so we can then
    turn around and turn it _back_ into text.
    
    Since we're in a stable series and who knows what might be parsing the
    error message, take care to output the same format that was previously
    returned.  We should consider trimming the error message for 4.2 to
    remove the useless static text.

diff --git a/bin/rt-mailgate.in b/bin/rt-mailgate.in
index b86b562..9ad129a 100755
--- a/bin/rt-mailgate.in
+++ b/bin/rt-mailgate.in
@@ -253,20 +253,13 @@ sub check_failure {
     my $r    = shift;
     return if $r->is_success;
 
-    # This ordinarily oughtn't to be able to happen, suggests a bug in RT.
-    # So only load these heavy modules when they're needed.
-    require HTML::TreeBuilder;
-    require HTML::FormatText;
-
-    my $error = $r->error_as_HTML;
-    my $tree  = HTML::TreeBuilder->new->parse($error);
-    $tree->eof;
-
-    # It'll be a cold day in hell before RT sends out bounces in HTML
-    my $formatter =
-        HTML::FormatText->new( leftmargin  => 0,
-                               rightmargin => 50, );
-    print STDERR $formatter->format($tree);
+    # XXX TODO 4.2: Remove the multi-line error strings in favor of something more concise
+    print STDERR <<"    ERROR";
+An Error Occurred
+=================
+
+@{[ $r->status_line ]}
+    ERROR
     print STDERR "\n$0: undefined server error\n" if $opts->{'debug'};
     return $self->tempfail();
 }
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index e049675..03c813b 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -189,6 +189,8 @@ File::ShareDir
 File::Spec 0.8
 HTML::Quoted
 HTML::Scrubber 0.08
+HTML::TreeBuilder
+HTML::FormatText
 Log::Dispatch 2.23
 Sys::Syslog 0.16
 Locale::Maketext 1.06
@@ -245,8 +247,6 @@ CGI::Emulate::PSGI
 .
 
 $deps{'MAILGATE'} = [ text_to_hash( << '.') ];
-HTML::TreeBuilder
-HTML::FormatText
 Getopt::Long
 LWP::UserAgent
 Pod::Usage

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


More information about the Rt-commit mailing list