]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Model/Base.pm
Allow authentication to set template and action.
[maypole.git] / lib / Maypole / Model / Base.pm
index 9d673c61858c69061c5e24ab30c3c4be2a0c3849..d092e502dd33ae61866d3d43c80d7d32528cdcb1 100644 (file)
@@ -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 {