X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FModel%2FBase.pm;h=d0e9ba81670c357160685195b205736513712b0a;hb=d3a3498e58b23918b3311da94f706bbfe2a576ee;hp=6fc70e6a4d6bc64377ce5c41627cf183b445103a;hpb=b6e2413ee413ce21b28429c05bbcc3f516a0754a;p=maypole.git diff --git a/lib/Maypole/Model/Base.pm b/lib/Maypole/Model/Base.pm index 6fc70e6..d0e9ba8 100644 --- a/lib/Maypole/Model/Base.pm +++ b/lib/Maypole/Model/Base.pm @@ -1,5 +1,6 @@ package Maypole::Model::Base; +use strict; use Maypole::Constants; use attributes (); @@ -7,7 +8,7 @@ our %remember; sub MODIFY_CODE_ATTRIBUTES { $remember{ $_[1] } = $_[2]; () } -sub FETCH_CODE_ATTRIBUTES { $remember{ $_[1] } } +sub FETCH_CODE_ATTRIBUTES { $remember{ $_[1] } || () } sub process { my ( $class, $r ) = @_; @@ -15,7 +16,8 @@ sub process { return if $r->{template}; # Authentication has set this, we're done. $r->{template} = $method; - $r->objects([ $class->fetch_objects($r) ]); + my $obj = $class->fetch_objects($r); + $r->objects([$obj]) if $obj; $class->$method( $r, $obj, @{ $r->{args} } ); } @@ -168,14 +170,6 @@ sub column_names { } $class->columns; } -=head2 description - -A description of the class to be passed to the template. - -=cut - -sub description { "A poorly defined class" } - =head2 is_public should return true if a certain action is supported, or false otherwise. @@ -187,7 +181,7 @@ sub is_public { my ( $self, $action ) = @_; my $cv = $self->can($action); return 0 unless $cv; - my $attrs = join " ", attributes::get($cv); + my $attrs = join " ", (attributes::get($cv) || ()); do { warn "$action not exported" if Maypole->debug; return 0;