]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Model/CDBI.pm
Fixed mime type setting, fixed errors in revision 445, folded in Maypole::Component...
[maypole.git] / lib / Maypole / Model / CDBI.pm
index dd9af06c71472df111a129e51bda562173becf65..a5c65f65166c417f1171ee051e97768713ee188e 100644 (file)
@@ -29,7 +29,7 @@ use Class::DBI::Plugin::RetrieveAll;
 use Class::DBI::Pager;
 
 use Lingua::EN::Inflect::Number qw(to_PL);
-
+use attributes ();
 
 ###############################################################################
 # Helper methods
@@ -301,29 +301,6 @@ sub adopt {
     }
 }
 
-=head2 is_public
-
-Should return true if a certain action is supported, or false otherwise.
-Defaults to checking if the sub has the C<:Exported> attribute.
-
-=cut
-
-sub is_public {
-    my ( $self, $action, $attrs ) = @_;
-       my $cv = $self->can($action);
-       warn "is_public failed . action is $action. self is $self" and return 0 unless $cv;
-       unless ($attrs) { 
-         my @attrs = attributes::get($cv) || ();
-         $attrs = join " ", @attrs;
-       }
-       do {
-         warn "is_public failed .$action not exported" if Maypole->debug;
-         return 0;
-       } unless $attrs =~ /\bExported\b/i;
-       return 1;
-}
-
-
 =head2 is_class
 
 Tell if action is a class method (See Maypole::Plugin::Menu)
@@ -333,7 +310,7 @@ Tell if action is a class method (See Maypole::Plugin::Menu)
 sub is_class {
        my ( $self, $method, $attrs ) = @_;
        die "Usage: method must be passed as first arg" unless $method;
-       $attrs = $self->method_attrs($method) unless ($attrs);
+       $attrs = join(' ',$self->method_attrs($method)) unless ($attrs);
        return 1 if $attrs  =~ /\bClass\b/i;
        return 1 if $method =~ /^list$/;  # default class actions
        return 0;
@@ -348,20 +325,12 @@ Tell if action is a object method (See Maypole::Plugin::Menu)
 sub is_object {
        my ( $self, $method, $attrs ) = @_;
        die "Usage: method must be passed as first arg" unless $method;
-       $attrs = $self->method_attrs($method) unless ($attrs);
+       $attrs = join(' ',$self->method_attrs($method)) unless ($attrs);
        return 1 if $attrs  =~ /\bObject\b/i;
        return 1 if $method =~ /(^view$|^edit$|^delete$)/;  # default object actions
        return 0;
 }
 
-# Get string of joined attributes for matching
-sub method_attrs {
-       my ($class, $method) = @_;
-       my $cv = $class->can($method);
-       return 0 unless $cv;
-       my @attrs = attributes::get($cv) || ();
-       return  join " ", @attrs;
-}
 
 =head2 related