[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-654-g1962f20
Shawn Moore
sartak at bestpractical.com
Tue Aug 31 18:09:38 EDT 2010
The branch, 3.9-trunk has been updated
via 1962f202c38d3a3304d388f34636744d1fc5029a (commit)
via bfb60583abd4566bb94be381c3f31f6ceaebb5a9 (commit)
from f8c7c215de92536de1ef8a8633870b434b8ec318 (commit)
Summary of changes:
lib/RT/Date.pm | 7 +---
lib/RT/Installer.pm | 57 +++++++++++++----------------------
share/html/Elements/SelectTimezone | 23 ++++----------
t/api/date.t | 5 +--
4 files changed, 32 insertions(+), 60 deletions(-)
- Log -----------------------------------------------------------------
commit bfb60583abd4566bb94be381c3f31f6ceaebb5a9
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Aug 31 17:51:23 2010 -0400
We unconditionally load DateTime so we don't need to eval guard loading it
diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index 28bab0e..ee9b6aa 100755
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -119,8 +119,7 @@ our @FORMATTERS = (
'RFC2616', # loc
'iCal', # loc
);
-if ( eval 'use DateTime qw(); 1;' && eval 'use DateTime::Locale qw(); 1;' &&
- DateTime->can('format_cldr') && DateTime::Locale::root->can('date_format_full') ) {
+if (DateTime->can('format_cldr') && DateTime::Locale::root->can('date_format_full') ) {
push @FORMATTERS, 'LocalizedDateTime'; # loc
}
@@ -654,8 +653,6 @@ 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');
diff --git a/lib/RT/Installer.pm b/lib/RT/Installer.pm
index 26786e4..d44c6ea 100644
--- a/lib/RT/Installer.pm
+++ b/lib/RT/Installer.pm
@@ -49,6 +49,7 @@
package RT::Installer;
use strict;
use warnings;
+use DateTime;
require UNIVERSAL::require;
my %Meta = (
@@ -184,27 +185,7 @@ my %Meta = (
Description => 'Path to sendmail', #loc
},
},
- WebDomain => {
- Widget => '/Widgets/Form/String',
- WidgetArguments => {
- Description => 'Domain name', #loc
- Hints => "Don't include http://, just something like 'localhost', 'rt.example.com'", #loc
- },
- },
- WebPort => {
- Widget => '/Widgets/Form/Integer',
- WidgetArguments => {
- Description => 'Web port', #loc
- Hints => 'which port your web server will listen to, e.g. 8080', #loc
- },
- },
-
-);
-
-my $HAS_DATETIME_TZ = eval { require DateTime::TimeZone };
-
-if ($HAS_DATETIME_TZ) {
- $Meta{Timezone} = {
+ Timezone => {
Widget => '/Widgets/Form/Select',
WidgetArguments => {
Description => 'Timezone', #loc
@@ -212,30 +193,34 @@ if ($HAS_DATETIME_TZ) {
my $ret;
$ret->{Values} = ['', DateTime::TimeZone->all_names];
- my $has_datetime = eval { require DateTime };
- if ( $has_datetime ) {
- my $dt = DateTime->now;
- for my $tz ( DateTime::TimeZone->all_names ) {
- $dt->set_time_zone( $tz );
- $ret->{ValuesLabel}{$tz} =
- $tz . ' ' . $dt->strftime('%z');
- }
+ my $dt = DateTime->now;
+ for my $tz ( DateTime::TimeZone->all_names ) {
+ $dt->set_time_zone( $tz );
+ $ret->{ValuesLabel}{$tz} =
+ $tz . ' ' . $dt->strftime('%z');
}
$ret->{ValuesLabel}{''} = 'System Default'; #loc
return $ret;
},
},
- };
-}
-else {
- $Meta{Timezone} = {
+ },
+ WebDomain => {
Widget => '/Widgets/Form/String',
WidgetArguments => {
- Description => 'Timezone', #loc
+ Description => 'Domain name', #loc
+ Hints => "Don't include http://, just something like 'localhost', 'rt.example.com'", #loc
},
- };
-}
+ },
+ WebPort => {
+ Widget => '/Widgets/Form/Integer',
+ WidgetArguments => {
+ Description => 'Web port', #loc
+ Hints => 'which port your web server will listen to, e.g. 8080', #loc
+ },
+ },
+
+);
sub Meta {
my $class = shift;
diff --git a/share/html/Elements/SelectTimezone b/share/html/Elements/SelectTimezone
index 75ac301..357a55e 100644
--- a/share/html/Elements/SelectTimezone
+++ b/share/html/Elements/SelectTimezone
@@ -46,26 +46,18 @@
%#
%# END BPS TAGGED BLOCK }}}
<%ONCE>
-my $HAS_DATETIME_TZ = eval { require DateTime::TimeZone };
-my $HAS_DATETIME = eval { require DateTime };
+use DateTime;
-my (@names, %label);
-if ( $HAS_DATETIME_TZ ) {
- @names = DateTime::TimeZone->all_names;
-}
+my @names = DateTime::TimeZone->all_names;
-if ( $HAS_DATETIME ) {
- my $dt = DateTime->now;
- for ( @names ) {
- $dt->set_time_zone( $_ );
- $label{$_} = $_ . ' ' . $dt->strftime('%z');
- }
+my %label;
+my $dt = DateTime->now;
+for ( @names ) {
+ $dt->set_time_zone( $_ );
+ $label{$_} = $_ . ' ' . $dt->strftime('%z');
}
</%ONCE>
-% unless ( $HAS_DATETIME_TZ && @names ) {
-<input type="text" name="<% $Name %>" value="<% $Default %>" />
-% } else {
<select name="<% $Name %>">
% if ( $ShowNullOption ) {
<option value=""><&|/l&>System Default</&></option>
@@ -75,7 +67,6 @@ if ( $HAS_DATETIME ) {
|n %> ><% $label{$tz} || $tz %></option>
% }
</select>
-% }
<%ARGS>
$ShowNullOption => 1
$Name => undef
diff --git a/t/api/date.t b/t/api/date.t
index ce51465..fb43d8c 100644
--- a/t/api/date.t
+++ b/t/api/date.t
@@ -1,6 +1,7 @@
#!/usr/bin/perl
use Test::MockTime qw(set_fixed_time restore_time);
+use DateTime;
use Test::More;
my $tests;
@@ -8,9 +9,7 @@ my $tests;
my $localized_datetime_tests;
BEGIN {
$tests = 165;
- $localized_datetime_tests =
- eval { require DateTime; 1; } && eval { require DateTime::Locale; 1; } &&
- DateTime->can('format_cldr') && DateTime::Locale::root->can('date_format_full');
+ $localized_datetime_tests = DateTime->can('format_cldr') && DateTime::Locale::root->can('date_format_full');
if ($localized_datetime_tests) {
commit 1962f202c38d3a3304d388f34636744d1fc5029a
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Aug 31 17:56:39 2010 -0400
Kill another indirect method call
diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index ee9b6aa..392114c 100755
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -654,7 +654,7 @@ sub LocalizedDateTime
);
return $self->loc("DateTime doesn't support format_cldr, you must upgrade to use this feature")
- unless can DateTime::('format_cldr');
+ unless DateTime::->can('format_cldr');
my $date_format = $args{'DateFormat'};
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list