[jifty-devel] Order of Component Roots in Jifty
dbaster at bigpond.net.au
dbaster at bigpond.net.au
Mon Oct 30 06:30:48 EST 2006
> Message: 2
> Date: Sat, 28 Oct 2006 23:38:50 -0400
> From: Jesse Vincent <jesse at bestpractical.com>
> Subject: Re: [jifty-devel] Order of Component Roots in Jifty
> To: Nifty apps in a Jiffy <jifty-devel at lists.jifty.org>
> Message-ID: <20061029033849.GI25226 at bestpractical.com>
> Content-Type: text/plain; charset=us-ascii
>
>
>
>
> On Fri, Oct 27, 2006 at 08:28:45PM +1000, dbaster at bigpond.net.au wrote:
> > Hi there,
> > I have been writing a plugin for Jifty but found during testing that a component defined in the Plugin does not override an existing Jifty component. After investigation, I found that Handler.pm loads the Plugin's component root below the Jifty component and the Application component roots.
> >
> > I suggest that a Plugin's component root should be loaded above Jifty and Application so a Plugin does have the ability to overload an existing Mason component.
>
> You really want the plugin component root to override an application's
> custom templates? That feels not-right to me. I suspect we really want
>
> App
> ---
> Plugins
> ---
> Core
>
> Of course, what I want for christmas is a templating system with real
> inheritance.
>
> -j
>
Jesse,
Yes, a good point. I looked at my code and I wanted to override CORE templates only. APPLICATION templates should be unique.
Therefore :
--- Handler.pm.a 2006-10-27 19:27:37.000000000 +1000
+++ Handler.pm 2006-10-30 22:17:27.000000000 +1100
@@ -123,9 +123,7 @@
qw[ $JiftyWeb ],
@{Jifty->config->framework('Web')->{'Globals'} || []},
],
- comp_root => [
- [application => Jifty::Util->absolute_path( Jifty->config->framework('Web')->{'TemplateRoot'} )],
- [jifty => Jifty->config->framework('Web')->{'DefaultTemplateRoot'}],
+ comp_root => [[jifty => Jifty->config->framework('Web')->{'DefaultTemplateRoot'}],
],
%{ Jifty->config->framework('Web')->{'MasonConfig'} },
);
@@ -133,9 +131,11 @@
for my $plugin (Jifty->plugins) {
my $comp_root = $plugin->template_root;
next unless $comp_root;
- push @{ $config{comp_root} }, [ ref($plugin)."-".Jifty->web->serial => $comp_root ];
+ unshift @{ $config{comp_root} }, [ ref($plugin)."-".Jifty->web->serial => $comp_root ];
}
-
+ unshift @{ $config{comp_root} },
+ [ application => Jifty::Util->absolute_path( Jifty->config->framework('Web')->{'TemplateRoot'} ) ];
+
# In developer mode, we want halos, refreshing and all that other good stuff.
if (Jifty->config->framework('DevelMode') ) {
push @{$config{'plugins'}}, 'Jifty::Mason::Halo';
Daryl
PubSub Message bus looks cool. Do you intend to have Request / Reply ?
More information about the jifty-devel
mailing list