From: Aaron Trevena Date: Fri, 23 Mar 2007 19:10:55 +0000 (+0000) Subject: change to view::base to only call display_columns, stringify_columns, to_cgi if... X-Git-Tag: 2.12~16 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=15ccc6266852d11e4e4aa10c67b15c70fe9470fb;p=maypole.git change to view::base to only call display_columns, stringify_columns, to_cgi if model class can() git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@558 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/Changes b/Changes index 977dd0a..cf75554 100644 --- a/Changes +++ b/Changes @@ -24,6 +24,7 @@ For information about current developments and future releases, see: fix to template being reset from path in plain templates (i.e. where no model), may affect those relying on the bug ( bug 23722 ) added search_columns method to base cdbi model class, provides display_columns unless over-ridden fix to display_line macro in factory templates (bug 22920) + fix to correct problem with LocationMatch and regex based Location directives in apache config. 2.11 Mon 31 July 2006 diff --git a/lib/Maypole/View/Base.pm b/lib/Maypole/View/Base.pm index 753430a..07564c2 100644 --- a/lib/Maypole/View/Base.pm +++ b/lib/Maypole/View/Base.pm @@ -48,14 +48,14 @@ sub vars { my $classmeta = $r->template_args->{classmetadata} ||= {}; $classmeta->{name} ||= $class; $classmeta->{table} ||= $class->table; - $classmeta->{columns} ||= [ $class->display_columns ]; - $classmeta->{list_columns} ||= [ $class->list_columns ]; - $classmeta->{colnames} ||= { $class->column_names }; + $classmeta->{columns} ||= [ $class->display_columns ] if ($class->can('display_columns')); + $classmeta->{list_columns} ||= [ $class->list_columns ] if ($class->can('list_columns')); + $classmeta->{colnames} ||= { $class->column_names } if ($class->can('column_names')); $classmeta->{related_accessors} ||= [ $class->related($r) ]; $classmeta->{moniker} ||= $class->moniker; $classmeta->{plural} ||= $class->plural_moniker; - $classmeta->{cgi} ||= { $class->to_cgi } if ($r->build_form_elements); - $classmeta->{stringify_column} ||= $class->stringify_column; + $classmeta->{cgi} ||= { $class->to_cgi } if ($r->build_form_elements && $class->can('to_cgi')); + $classmeta->{stringify_column} ||= $class->stringify_column if ($class->can('stringify_column')); # User-friendliness facility for custom template writers. if ( @{ $r->objects || [] } > 1 ) {