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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Jun 11 13:53:49 EDT 2006


Author: jesse
Date: Sun Jun 11 13:53:49 2006
New Revision: 1257

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

Log:
 r12500 at pinglin:  jesse | 2006-06-11 13:52:04 -0400
 * _get_current_user is nice magic for user code, so that users don't need to pass in the current user's context all the time. But when we _know_ that's what should happen inside the Jifty core, it can save us some serious CPU time. (20% in one test here)


Modified: jifty/trunk/lib/Jifty/Action.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action.pm	(original)
+++ jifty/trunk/lib/Jifty/Action.pm	Sun Jun 11 13:53:49 2006
@@ -76,9 +76,14 @@
         arguments  => {},
         sticky_on_success => 0,
         sticky_on_failure => 1,
+	current_user => undef,
         @_);
 
-    $self->_get_current_user;
+    if ($args{'current_user'}) {
+	$self->current_user($args{current_user});
+    } else {
+    	$self->_get_current_user();
+    }
 
     $self->moniker($args{'moniker'} || 'auto-'.Jifty->web->serial);
     $self->order($args{'order'});

Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm	(original)
+++ jifty/trunk/lib/Jifty/Web.pm	Sun Jun 11 13:53:49 2006
@@ -406,7 +406,7 @@
 
     my $action;
     # XXX TODO bullet proof
-    eval { $action = $class->new( %args, arguments => {%arguments} ); };
+    eval { $action = $class->new( %args, arguments => {%arguments}, current_user => $self->current_user ); };
     if ($@) {
         my $err = $@;
         $self->log->fatal($err);


More information about the Jifty-commit mailing list