[Jifty-commit] r6541 - in jifty/trunk: lib/Jifty
Jifty commits
jifty-commit at lists.jifty.org
Tue Mar 3 15:39:14 EST 2009
Author: sartak
Date: Tue Mar 3 15:39:11 2009
New Revision: 6541
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/DateTime.pm
Log:
r80814 at onn: sartak | 2009-03-03 15:39:02 -0500
Always set the current user's time zone
Modified: jifty/trunk/lib/Jifty/DateTime.pm
==============================================================================
--- jifty/trunk/lib/Jifty/DateTime.pm (original)
+++ jifty/trunk/lib/Jifty/DateTime.pm Tue Mar 3 15:39:11 2009
@@ -63,7 +63,7 @@
my $self = $class->SUPER::new(%args);
- $self->current_user($current_user) if $current_user;
+ $self->current_user($current_user);
# XXX What if they really mean midnight offset by time zone?
@@ -115,9 +115,9 @@
my %args = @_;
my $current_user = delete $args{current_user};
- my $self = $class->SUPER::now(%args);
+ my $self = $class->SUPER::now(%args);
- $self->current_user($current_user) if $current_user;
+ $self->current_user($current_user);
$self->time_zone($args{time_zone}) if $args{time_zone};
return $self;
@@ -134,9 +134,9 @@
my %args = @_;
my $current_user = delete $args{current_user};
- my $self = $class->SUPER::from_epoch(%args);
+ my $self = $class->SUPER::from_epoch(%args);
- $self->current_user($current_user) if $current_user;
+ $self->current_user($current_user);
$self->time_zone($args{time_zone}) if $args{time_zone};
return $self;
@@ -151,6 +151,11 @@
sub current_user {
my $self = shift;
return $self->SUPER::current_user unless @_;
+
+ # $date->current_user(undef) will not remove the current user, but it will
+ # calculate who the current user is for setting the time zone
+ shift if @_ == 1 && !defined($_[0]);
+
my $ret = $self->SUPER::current_user(@_);
$self->set_current_user_timezone();
return $ret;
More information about the Jifty-commit
mailing list