[Jifty-commit] r2641 - jifty/trunk/lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sat Jan 27 01:51:40 EST 2007
Author: audreyt
Date: Sat Jan 27 01:51:40 2007
New Revision: 2641
Modified:
jifty/trunk/lib/Jifty/Web.pm
Log:
* Jifty::Web - Add private accessor for _state_variables to
avoid typo-prone ->{'state_variables'}.
Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm (original)
+++ jifty/trunk/lib/Jifty/Web.pm Sat Jan 27 01:51:40 2007
@@ -22,7 +22,7 @@
use vars qw/$SERIAL @JS_INCLUDES/;
__PACKAGE__->mk_accessors(
- qw(next_page force_redirect request response session temporary_current_user _current_user)
+ qw(next_page force_redirect request response session temporary_current_user _current_user _state_variables)
);
__PACKAGE__->mk_classdata($_)
@@ -81,6 +81,7 @@
my $class = shift;
my $self = bless {region_stack => []}, $class;
$self->session(Jifty::Web::Session->new());
+ $self->clear_state_variables;
return ($self);
}
@@ -566,7 +567,7 @@
and $self->next_page
and ( ( $self->next_page ne $self->request->path )
or $self->request->state_variables
- or $self->{'state_variables'} )
+ or $self->state_variables )
)
{
return (1);
@@ -605,15 +606,15 @@
if ( (grep { not $_->action_class->isa('Jifty::Action::Redirect') }
values %{ { $self->response->results } })
or $self->request->state_variables
- or $self->{'state_variables'}
+ or $self->state_variables
or $self->request->continuation
or grep { $_->active and not $_->class->isa('Jifty::Action::Redirect') } @actions )
{
my $request = Jifty::Request->new();
$request->add_state_variable( key => $_->key, value => $_->value )
for $self->request->state_variables;
- $request->add_state_variable( key => $_, value => $self->{'state_variables'}->{$_} )
- for keys %{ $self->{'state_variables'} };
+ $request->add_state_variable( key => $_, value => $self->_state_variables->{$_} )
+ for keys %{ $self->_state_variables };
for (@actions) {
my $new_action = $request->add_action(
moniker => $_->moniker,
@@ -1169,9 +1170,9 @@
my $value = shift;
if (!defined($value)) {
- delete $self->{'state_variables'}->{$name};
+ delete $self->_state_variables->{$name};
} else {
- $self->{'state_variables'}->{$name} = $value;
+ $self->_state_variables->{$name} = $value;
}
}
@@ -1188,11 +1189,7 @@
sub state_variables {
my $self = shift;
- my %vars;
- $vars{$_} = $self->{'state_variables'}->{$_}
- for keys %{ $self->{'state_variables'} };
-
- return %vars;
+ return %{ $self->_state_variables };
}
=head3 clear_state_variables
@@ -1204,7 +1201,7 @@
sub clear_state_variables {
my $self = shift;
- $self->{'state_variables'} = {};
+ $self->_state_variables({});
}
=head2 REGIONS
More information about the Jifty-commit
mailing list