From: Simon Cozens Date: Thu, 19 Feb 2004 15:42:05 +0000 (+0000) Subject: Allow authentication to set template and action. X-Git-Tag: 2.10~294 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=e82766d6aab88a10e75b4669f44d2dbe7ff9d766;p=maypole.git Allow authentication to set template and action. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@68 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/lib/Maypole/Model/Base.pm b/lib/Maypole/Model/Base.pm index 9d673c6..d092e50 100644 --- a/lib/Maypole/Model/Base.pm +++ b/lib/Maypole/Model/Base.pm @@ -8,9 +8,13 @@ sub edit :Exported { } sub process { my ($class, $r) = @_; - $r->template( my $method = $r->action ); + my $method = $r->action; + $r->{template} ||= $method; # Authentication may have done this for us $r->objects([ $class->retrieve(shift @{$r->{args}}) ]); - $class->$method($r); + + # This allows the authentication mechanism to set the template + # without needing to define an action. + $class->$method($r) if $class->can($method); } sub display_columns {