X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FModel%2FBase.pm;h=30dacfe60015ad8227a4370fb1d5dff180c38242;hb=43c803ceb66d273f53b343229ed1ebd6eb0fc142;hp=d092e502dd33ae61866d3d43c80d7d32528cdcb1;hpb=5617e978a18a37c2d401674f1b793a041b390bce;p=maypole.git diff --git a/lib/Maypole/Model/Base.pm b/lib/Maypole/Model/Base.pm index d092e50..30dacfe 100644 --- a/lib/Maypole/Model/Base.pm +++ b/lib/Maypole/Model/Base.pm @@ -9,12 +9,15 @@ sub edit :Exported { } sub process { my ($class, $r) = @_; my $method = $r->action; - $r->{template} ||= $method; # Authentication may have done this for us - $r->objects([ $class->retrieve(shift @{$r->{args}}) ]); - - # This allows the authentication mechanism to set the template - # without needing to define an action. - $class->$method($r) if $class->can($method); + return if $r->{template}; # Authentication has set this, we're done. + + $r->{template} = $method; + my $obj = $class->retrieve( $r->{args}->[0] ); + if ($obj) { + $r->objects([ $obj ]); + shift @{$r->{args}}; + } + $class->$method($r); } sub display_columns {