[Catalyst-commits] r7833 -
trunk/Catalyst-View-Mason/lib/Catalyst/View
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Wed May 28 14:46:38 BST 2008
Author: rafl
Date: 2008-05-28 14:46:38 +0100 (Wed, 28 May 2008)
New Revision: 7833
Modified:
trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
Log:
Implement always_append_template_extension.
Modified: trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
===================================================================
--- trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm 2008-05-28 13:46:31 UTC (rev 7832)
+++ trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm 2008-05-28 13:46:38 UTC (rev 7833)
@@ -73,11 +73,12 @@
my ($self, $c, $arguments) = @_;
my %config = (
- comp_root => $c->config->{root},
- data_dir => File::Spec->tmpdir,
- use_match => 1,
- allow_globals => [],
- template_extension => q//,
+ comp_root => $c->config->{root},
+ data_dir => File::Spec->tmpdir,
+ use_match => 1,
+ allow_globals => [],
+ template_extension => q//,
+ always_append_template_extension => 0,
%{ $self->config },
%{ $arguments },
);
@@ -95,7 +96,12 @@
$self->config({ %config });
- delete @config{qw/use_match template_extension/};
+ # those are config options for the view, not mason itself.
+ delete @config{qw/
+ use_match
+ template_extension
+ always_append_template_extension
+ /};
if ($self->config->{use_match}) {
$c->log->warn(sprintf(<<'EOW', ref $self));
@@ -126,13 +132,18 @@
my ($self, $c) = @_;
my $component_path = $c->stash->{template};
+ my $extension = $self->config->{template_extension};
- unless ($component_path) {
+ if (defined $component_path) {
+ $component_path .= $extension
+ if $self->config->{always_append_template_extension};
+ }
+ else {
$component_path = $self->config->{use_match}
? $c->request->match
: $c->action;
- $component_path .= $self->config->{template_extension};
+ $component_path .= $extension;
}
return $component_path;
More information about the Catalyst-commits
mailing list