[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.6-88-g5900098

Kevin Falcone falcone at bestpractical.com
Sun Nov 8 21:13:01 EST 2009


The branch, 3.8-trunk has been updated
       via  59000984a6f50c1290a81d116c38a0a87534eae0 (commit)
      from  28454656545278bc38aabe3b2b63fc64f4541152 (commit)

Summary of changes:
 lib/RT/Date.pm |   12 +++++++++++-
 t/api/date.t   |    3 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 59000984a6f50c1290a81d116c38a0a87534eae0
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Sun Nov 8 11:16:16 2009 -0500

    Stop people with old DateTime or DateTime::Locales from exploding in Preferences
    
    We need to find a better way to work around the DateTime namespace
    conflicts

diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index 18f7ce7..fc4c43c 100755
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -117,7 +117,8 @@ our @FORMATTERS = (
     'RFC2616',       # loc
     'iCal',          # loc
 );
-if ( eval 'use DateTime qw(); 1;' && eval 'use DateTime::Locale qw(); 1;' ) {
+if ( eval 'use DateTime qw(); 1;' && eval 'use DateTime::Locale qw(); 1;' && 
+     DateTime->can('format_cldr') && DateTime::Locale::root->can('date_format_full') ) {
     push @FORMATTERS, 'LocalizedDateTime'; # loc
 }
 
@@ -501,6 +502,9 @@ as described in L</Get>.
 
 sub DateTime {
     my $self = shift;
+    unless (defined $self) {
+        use Carp; Carp::confess("undefined $self");
+    }
     return $self->Get( @_, Date => 1, Time => 1 );
 }
 
@@ -650,6 +654,10 @@ sub LocalizedDateTime
 
     return $self->loc("DateTime module missing") unless ( eval 'use DateTime qw(); 1;' );
     return $self->loc("DateTime::Locale module missing") unless ( eval 'use DateTime::Locale qw(); 1;' );
+    return $self->loc("DateTime doesn't support format_cldr, you must upgrade to use this feature") 
+        unless can DateTime::('format_cldr');
+
+
     my $date_format = $args{'DateFormat'};
     my $time_format = $args{'TimeFormat'};
 
@@ -661,6 +669,8 @@ sub LocalizedDateTime
     
 
     my $formatter = DateTime::Locale->load($lang);
+    return $self->loc("DateTime::Locale doesn't support date_format_full, you must upgrade to use this feature") 
+        unless $formatter->can('date_format_full');
     $date_format = $formatter->$date_format;
     $time_format = $formatter->$time_format;
     $date_format =~ s/EEEE/EEE/g if ( $args{'AbbrDay'} );
diff --git a/t/api/date.t b/t/api/date.t
index 7d0e853..bc1446f 100644
--- a/t/api/date.t
+++ b/t/api/date.t
@@ -9,7 +9,8 @@ my $localized_datetime_tests;
 BEGIN {
     $tests = 167;
     $localized_datetime_tests =
-      eval { require DateTime; 1; } && eval { require DateTime::Locale; 1; };
+      eval { require DateTime; 1; } && eval { require DateTime::Locale; 1; } &&
+      DateTime->can('format_cldr') && DateTime::Locale::root->can('date_format_full');
 
     if ($localized_datetime_tests) {
 

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


More information about the Rt-commit mailing list