[Jifty-commit] r6608 - in jifty/trunk: lib/Jifty

Jifty commits jifty-commit at lists.jifty.org
Tue Mar 17 10:58:13 EDT 2009


Author: alexmv
Date: Tue Mar 17 10:58:10 2009
New Revision: 6608

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web.pm

Log:
 r43247 at kohr-ah:  chmrr | 2009-03-17 10:28:38 -0400
 Don't use Class::Accessors with underscores, as they buy us nothing in terms of abstraction, and add slow method calls


Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm	(original)
+++ jifty/trunk/lib/Jifty/Web.pm	Tue Mar 17 10:58:10 2009
@@ -20,7 +20,7 @@
 use vars qw/$SERIAL @JS_INCLUDES/;
 
 __PACKAGE__->mk_accessors(
-    qw(next_page force_redirect request response session temporary_current_user _current_user _state_variables)
+    qw(next_page force_redirect request response session temporary_current_user)
 );
 
 __PACKAGE__->mk_classdata($_)
@@ -241,15 +241,15 @@
         my $currentuser_obj = shift;
         $self->session->set(
             'user_id' => $currentuser_obj ? $currentuser_obj->id : undef );
-        $self->_current_user( $currentuser_obj || undef );
+        $self->{current_user} = ( $currentuser_obj || undef );
     }
 
     my $object;
 
     if ( defined $self->temporary_current_user ) {
         return $self->temporary_current_user;
-    } elsif ( defined $self->_current_user ) {
-        return $self->_current_user;
+    } elsif ( defined $self->{current_user} ) {
+        return $self->{current_user};
     } elsif ( my $id = $self->session->get('user_id') ) {
          $object = Jifty->app_class({require => 0}, "CurrentUser")->new( id => $id );
     } elsif ( Jifty->config->framework('AdminMode')) {
@@ -258,7 +258,7 @@
          $object = Jifty->app_class({require => 0}, "CurrentUser")->new;
     }
     
-    $self->_current_user($object);
+    $self->{current_user} = $object;
     return $object;
 }
 
@@ -715,8 +715,8 @@
         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,
@@ -1246,9 +1246,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;
     }
 
 }
@@ -1265,7 +1265,7 @@
 
 sub state_variables {
     my $self = shift;
-    return %{ $self->_state_variables };
+    return %{ $self->{state_variables} };
 }
 
 =head3 clear_state_variables
@@ -1277,7 +1277,7 @@
 sub clear_state_variables {
     my $self = shift;
 
-    $self->_state_variables({});
+    $self->{state_variables} = {};
 }
 
 =head2 REGIONS


More information about the Jifty-commit mailing list