]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Model/Base.pm
This is 1.3
[maypole.git] / lib / Maypole / Model / Base.pm
index d092e502dd33ae61866d3d43c80d7d32528cdcb1..a9b3a32a7b9b57ccb6d13f652db6175a1b94fc48 100644 (file)
@@ -9,12 +9,16 @@ 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;
+    $r->objects([]);
+    my $obj = $class->retrieve( $r->{args}->[0] );
+    if ($obj) {
+        $r->objects([ $obj ]);
+        shift @{$r->{args}};
+    }
+    $class->$method($r);
 }
 
 sub display_columns {