From: Simon Cozens Date: Mon, 24 Jan 2005 20:43:36 +0000 (+0000) Subject: Release 2.08. Add Maypole::Config->template_extension, Maypole::Application adds... X-Git-Tag: 2.10~30 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=5ca6a1765a44c39b23e7bab0e2ba636dbc6b57a8;p=maypole.git Release 2.08. Add Maypole::Config->template_extension, Maypole::Application adds plugins to appropriate @ISA git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@334 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/Changes b/Changes index 96caa5d..ccc23d9 100644 --- a/Changes +++ b/Changes @@ -2,7 +2,20 @@ This file documents the revision history for Perl extension Maypole. For information about current developments and future releases, see: http://maypole.perl.org/?TheRoadmap -2.07 Mon Jan 24 20:00:00 2005 +2.08 Mon Jan 24 20:45:00 2005 + - Added $r->config->template_extension() to set optional file extension + for templates (Dave Howorth) + + Fixes: + - Maypole::Application adds plugin classes to caller's @ISA (Marcus Ramberg) + - FETCH_CODE_ATRIBUTES in M::M::Base should return an empty list if there + are no attributes + - M::M::CDBI will warn() about Class::DBI::FromCGI errors + + +2.07 Sun Jan 16 18:45:00 2005 + (This version was not uploaded to CPAN) + Internal changes: - Removed Maypole::Model->description. It didn't work as expected and clashed with 'description' columns in the database @@ -12,9 +25,6 @@ For information about current developments and future releases, see: undefined element - Fixed overriding $r->template_args->{classmetadata} in M::V::Base (Thanks to Dave Howorth for spotting the mistake) - - FETCH_CODE_ATRIBUTES in M::M::Base should return an empty list if there - are no attributes - - M::M::CDBI will warn() about Class::DBI::FromCGI errors - #9473: Maypole::Model::CDBI->related_class (Thanks David Baird) - #9434: M::M::CDBI->search generated "uninitialized value" warnings diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index 45dd897..ce9e656 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -1,6 +1,6 @@ package Apache::MVC; -our $VERSION = '2.07'; +our $VERSION = '2.08'; use strict; use warnings; diff --git a/lib/CGI/Maypole.pm b/lib/CGI/Maypole.pm index e002cf2..7ea9ee7 100644 --- a/lib/CGI/Maypole.pm +++ b/lib/CGI/Maypole.pm @@ -6,7 +6,7 @@ use warnings; use CGI::Simple; use Maypole::Headers; -our $VERSION = '2.07'; +our $VERSION = '2.08'; sub run { my $self = shift; diff --git a/lib/Maypole.pm b/lib/Maypole.pm index 7f1e9d3..34e2ebb 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -7,7 +7,7 @@ use Maypole::Config; use Maypole::Constants; use Maypole::Headers; -our $VERSION = '2.07'; +our $VERSION = '2.08'; __PACKAGE__->mk_classdata($_) for qw( config init_done view_object ); __PACKAGE__->mk_accessors( diff --git a/lib/Maypole/Application.pm b/lib/Maypole/Application.pm index 18cd589..3336c1f 100644 --- a/lib/Maypole/Application.pm +++ b/lib/Maypole/Application.pm @@ -7,7 +7,7 @@ use Maypole; use Maypole::Config; our @ISA; -our $VERSION = '2.07'; +our $VERSION = '2.08'; sub import { my ( $self, @plugins ) = @_; @@ -28,7 +28,7 @@ sub import { if ($@) { warn qq(Loading plugin "Maypole::Plugin::$_" failed: $@) } else { warn "Loaded plugin: Maypole::Plugin::$_" if $caller->debug; - unshift @ISA, "Maypole::Plugin::$_"; + push @{"${caller}::ISA"}, "Maypole::Plugin::$_"; } } } diff --git a/lib/Maypole/Config.pm b/lib/Maypole/Config.pm index cc9a9f5..a2660d7 100644 --- a/lib/Maypole/Config.pm +++ b/lib/Maypole/Config.pm @@ -9,8 +9,9 @@ our $VERSION = "1." . sprintf "%04d", q$Rev$ =~ /: (\d+)/; # Public accessors. __PACKAGE__->mk_accessors( - qw( view view_options uri_base template_root model loader display_tables - ok_tables rows_per_page dsn user pass opts application_name) + qw( view view_options uri_base template_root template_extension model + loader display_tables ok_tables rows_per_page dsn user pass opts + application_name) ); # Should only be modified by model. @@ -46,6 +47,10 @@ Optional. Contains a list of all tables, if supported by model. +=head3 template_extension + +Optional template file extension. + =head3 template_root This is where your application can find its templates. diff --git a/lib/Maypole/View/TT.pm b/lib/Maypole/View/TT.pm index 59c3f8f..13130e5 100644 --- a/lib/Maypole/View/TT.pm +++ b/lib/Maypole/View/TT.pm @@ -21,8 +21,12 @@ sub template { $self->{provider}->include_path([ $self->paths($r) ]); + my $template_file = $r->template; + my $ext = $r->config->template_extension; + $template_file .= $ext if defined $ext; + my $output; - if ($self->{tt}->process( $r->template, { $self->vars($r) }, \$output )) { + if ($self->{tt}->process($template_file, { $self->vars($r) }, \$output )) { $r->{output} = $output; return OK; }