[Maypole] Patch to allow different ok_tables and display_tables

Marcus Ramberg marcus@thefeed.no
Tue, 01 Jun 2004 22:02:20 +0200


Hi. Some of the tables I want only accessible through links from other 
tables, others I want to display, so I've made this patch which allows 
you to specify ok_tables as well as display_tables . It also allows 
ok_tables to use the same format as display_tables.

Marcus

RCS file: /var/cvs/modules/Apache-MVC/lib/Maypole.pm,v
retrieving revision 1.18
diff -u -r1.18 Maypole.pm
@@ -89,7 +90,10 @@
 sub is_applicable {
     my $self = shift;
     my $config = $self->config;
-    $config->{ok_tables} = {map {$_ => 1} @{$config->{display_tables}}};
+    $config->{ok_tables} ||= @{$config->{display_tables}};
+    $config->{ok_tables} = {map {$_=>1} @{$config->{ok_tables}}}
+       if ref $config->{ok_tables} eq "ARRAY";
     warn "We don't have that table ($self->{table})"
         if $self->debug and not $config->{ok_tables}{$self->{table}};
     return DECLINED() unless exists $config->{ok_tables}{$self->{table}};

--
This e-mail has been protected by Song Networks' virus-scan service:
http://www.securemail.no