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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Mar 12 16:30:09 EDT 2007


Author: jesse
Date: Mon Mar 12 16:30:08 2007
New Revision: 2948

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

Log:
 r53366 at pinglin:  jesse | 2007-03-12 16:28:17 -0400
 * Jifty::CurrentUser now has a default "_init" behaviour.
 
 * The password auth plugin now works
 


Modified: jifty/trunk/lib/Jifty/CurrentUser.pm
==============================================================================
--- jifty/trunk/lib/Jifty/CurrentUser.pm	(original)
+++ jifty/trunk/lib/Jifty/CurrentUser.pm	Mon Mar 12 16:30:08 2007
@@ -48,7 +48,18 @@
     return $self;
 }
 
-sub _init { 1}
+
+sub _init {
+	    my $self = shift;
+	    my %args = (@_);
+	
+            if (keys %args) {
+	        $self->user_object(Jifty->app_class('Model', 'User')->new(current_user => $self));
+	        $self->user_object->load_by_cols(%args);
+	    }
+        return 1;
+}
+	
 
 =head2 superuser
 
@@ -70,7 +81,7 @@
 user. Generally, you're expected to set and load it in the _init method
 in your L<Jifty::CurrentUser> subclass.
 
-Example:  
+If you do nothing, code similar to this will be called by _init.
 
 	sub _init {
 	    my $self = shift;
@@ -80,7 +91,6 @@
 	        $self->user_object(Wifty::Model::User->new(current_user => $self));
 	        $self->user_object->load_by_cols(%args);
 	    }
-	    $self->SUPER::_init(%args);
 	}
 	
 


More information about the Jifty-commit mailing list