[jifty-devel] search for 'blah/index.html' in T::D path as well as Mason path

Edmund von der Burg evdb at ecclestoad.co.uk
Wed Mar 14 16:26:23 EDT 2007


Getting to grips with how Jifty handles templates I think that I have
found an inconsistency:

This is all in Jifty/Dispatcher.pm (revision 2963):

in _do_show (line 769) there is a bit of code that adds '/index.html'
to the end of the template path if there is  template component that
would match that. This is tested using 'template_exists'.

However 'template_exists' (line 1150) only checks for Mason templates,
it does not check for T::D templates. Should template_exists be
changed to:

sub template_exists {
    my $self     = shift;
    my $template = shift;

    return
         Jifty->handler->declare_handler->template_exists($template)
      || Jifty->handler->mason->interp->comp_exists($template);
}

This would check for TD templates first. As the 'render_templates'
tries to use a T::D template first this behaviour would be more
consistent.


Also would it not be better to check for the existance of a template
component first and then only add the '/index.html' to the end if one
is not found? As T::D components do not need to map to file names in
the same way that Mason ones do this might prevent some unexpected
behaviour.


Cheers,
  Edmund.


-- 
In reality I'm evdb at ecclestoad.co.uk - http://ecclestoad.co.uk


More information about the jifty-devel mailing list