sub process {
my ($class, $r) = @_;
- $r->template( my $method = $r->action );
- $r->objects([ $class->retrieve(shift @{$r->{args}}) ]);
+ my $method = $r->action;
+ return if $r->{template}; # Authentication has set this, we're done.
+
+ $r->{template} = $method;
+ $r->objects([]);
+ my $obj = $class->retrieve( $r->{args}->[0] );
+ if ($obj) {
+ $r->objects([ $obj ]);
+ shift @{$r->{args}};
+ }
$class->$method($r);
}