Hi, after reading some articles on the dancer advent calendar I started to examine dance in order to see, if I can replace my current MasonX::WebApp application with dancer. So I installed dancer 1.3 , and since I use Mason, I installed Dancer::Template::Mason. Now I found , that auto_page bypasses the template engine by checking, if a specific template exists , and that behavior its still present in Dancer2. In Dancer1 the code in Dancer::Renderer is my $view = Dancer::engine('template')->view($viewpath) || ''; if ($view && -f $view) { and in Dancer 2 in Dancer::Handler::AutoPage my $view_path = $template->view($page); if (! -f $view_path) { In Dancer::Template::Abstract a method "view_exists " exists , so why not use this? For Dancer1 the docs tells, override this function in your template class accordingly. But for auto_page, the template class is not asked if a template exists, and in my opinion, this behavior is not correct. What do you think about this ? Rolf
Hi, I Like the idea, as it helps decoupling between views and files, which ate not always the same. Can you provide a patch for either dancer 1 or ( preferably ) dancer 2 ? Thanks :) Le jeudi 27 décembre 2012 à 23:30, Rolf Schaufelberger a écrit :
Hi, after reading some articles on the dancer advent calendar I started to examine dance in order to see, if I can replace my current MasonX::WebApp application with dancer. So I installed dancer 1.3 , and since I use Mason, I installed Dancer::Template::Mason.
Now I found , that auto_page bypasses the template engine by checking, if a specific template exists , and that behavior its still present in Dancer2.
In Dancer1 the code in Dancer::Renderer is
my $view = Dancer::engine('template')->view($viewpath) || '';
if ($view && -f $view) {
and in Dancer 2 in Dancer::Handler::AutoPage
my $view_path = $template->view($page); if (! -f $view_path) {
In Dancer::Template::Abstract a method "view_exists " exists , so why not use this? For Dancer1 the docs tells, override this function in your template class accordingly. But for auto_page, the template class is not asked if a template exists, and in my opinion, this behavior is not correct. What do you think about this ?
Rolf
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
participants (2)
-
Damien Krotkine -
Rolf Schaufelberger