template() behaviour change in 1.3090 (immediately returning)
Hi all, Starting a new thread for visibility rather than responding in the "bug with multiple "template" calls ?" thread. In 1.3090, template() (and some other keywords, e.g. pass(), halt() etc) now immediately halt execution of the route handler. This made perfect sense for the other keywords affected, but for template(), it seems plenty of people are using template() in undocumented (but not incorrect) ways to generate emails etc, rather than intending the return value of template to be returned by their route handler immediately. Since this is causing problems for people, we're going to reverse this change, better document the behaviour and usage of the template keyword, and get a new release out ASAP. Sorry to those inconvenienced by this change - your complaints have been heard and listened to :) Cheers Dave P -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
On 16/12/11 10:35, David Precious wrote:
In 1.3090, template() (and some other keywords, e.g. pass(), halt() etc) now immediately halt execution of the route handler.
This made perfect sense for the other keywords affected, but for template(), it seems plenty of people are using template() in undocumented (but not incorrect) ways to generate emails etc, rather than intending the return value of template to be returned by their route handler immediately.
To be fair, it was documented to *not return*.
Since this is causing problems for people, we're going to reverse this change, better document the behaviour and usage of the template keyword, and get a new release out ASAP.
Good - because I'm not sure what square we'd all have to "occupy" if the decision had stood. Besides - it's too cold and wet here to be sat outside with a placard :-) -- Richard Huxton Archonet Ltd
+1. As pass() and other. Btw, are any reasons at all to halt the execution of the route handler in this functions? 16.12.2011 16:40, Richard Huxton пишет:
On 16/12/11 10:35, David Precious wrote:
In 1.3090, template() (and some other keywords, e.g. pass(), halt() etc) now immediately halt execution of the route handler. [...]
To be fair, it was documented to *not return*.
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130
On 16 December 2011 12:57, Nick Knutov <mail@knutov.com> wrote:
+1.
As pass() and other.
Btw, are any reasons at all to halt the execution of the route handler in this functions?
There were a nasty security issue that if you uses a hook to catch the fact that a user is not authenticated for instance, the workflow would still continue in the rest of the route, so we needed a way to stop the execution of the route code block only. And also, we wanted to enforce the fact that pass, send_error, etc.. really break the workflow. Otherwise people were having strange results when not returning immediately after that. They would continue doing some work, with the request response being in 'error' mode for instance. I think it's a good set of features, mekes things more robust. But I went a step too far with 'template' :)
16.12.2011 16:40, Richard Huxton пишет:
On 16/12/11 10:35, David Precious wrote:
In 1.3090, template() (and some other keywords, e.g. pass(), halt() etc) now immediately halt execution of the route handler.
[...]
To be fair, it was documented to *not return*.
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130
_______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
I always do something like return redirect '/error/?reason=...' unless pass_all_checks() I think I read in documentation or examples that it should be so and this way looks better - I can decide how it will work. I think it's better to make accent on using 'return' when it needed, not changing behavior. 16.12.2011 18:16, damien krotkine пишет:
On 16 December 2011 12:57, Nick Knutov<mail@knutov.com> wrote:
+1.
As pass() and other.
Btw, are any reasons at all to halt the execution of the route handler in this functions?
There were a nasty security issue that if you uses a hook to catch the fact that a user is not authenticated for instance, the workflow would still continue in the rest of the route, so we needed a way to stop the execution of the route code block only.
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130
Well your code will stil work, no need to change anything On 16 December 2011 13:33, Nick Knutov <mail@knutov.com> wrote:
I always do something like
return redirect '/error/?reason=...' unless pass_all_checks()
I think I read in documentation or examples that it should be so and this way looks better - I can decide how it will work.
I think it's better to make accent on using 'return' when it needed, not changing behavior.
16.12.2011 18:16, damien krotkine пишет:
On 16 December 2011 12:57, Nick Knutov<mail@knutov.com> wrote:
+1.
As pass() and other.
Btw, are any reasons at all to halt the execution of the route handler in this functions?
There were a nasty security issue that if you uses a hook to catch the fact that a user is not authenticated for instance, the workflow would still continue in the rest of the route, so we needed a way to stop the execution of the route code block only.
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130
Whoops! I responded in the wrong thread... :) On Fri, Dec 16, 2011 at 2:56 PM, damien krotkine <dkrotkine@gmail.com>wrote:
Well your code will stil work, no need to change anything
On 16 December 2011 13:33, Nick Knutov <mail@knutov.com> wrote:
I always do something like
return redirect '/error/?reason=...' unless pass_all_checks()
I think I read in documentation or examples that it should be so and this way looks better - I can decide how it will work.
I think it's better to make accent on using 'return' when it needed, not changing behavior.
16.12.2011 18:16, damien krotkine пишет:
On 16 December 2011 12:57, Nick Knutov<mail@knutov.com> wrote:
+1.
As pass() and other.
Btw, are any reasons at all to halt the execution of the route handler
in
this functions?
There were a nasty security issue that if you uses a hook to catch the fact that a user is not authenticated for instance, the workflow would still continue in the rest of the route, so we needed a way to stop the execution of the route code block only.
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130
Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
A new release (1.3091) is out on CPAN! It's got a few changes, most notably the return of the old template() call. Here is the changelog entry: 1.3091 17.12.2011 [ BUG FIXES ] * Reverting template() behavior by popular demand. (Damien Krotkine) * GH #714: Run post-request hooks when custom continuations were created. (Damien Krotkine) * Always call write_session_id() to update expires. (David Precious) [ ENHANCEMENTS ] * GH #711, #652: Add server_tokens variable to allow removal of headers. (John Wittkoski) [ DOCUMENTATION ] * GH #680: Document problems with multiple apps in Dancer using Plack::Handler::Apache2 and recommend a workaround. (Asaf Gordon, Pedro Melo) * RT #73258: Spelling glitches. (Damyan Ivanov) * Use ":script" instead of ":syntax" in Cookbook. (John Barrett) * Typos in Deployment doc. (David Precious) All in all, 5 tickets were resolved. Good job everyone! On Sat, Dec 17, 2011 at 11:26 AM, sawyer x <xsawyerx@gmail.com> wrote:
Whoops!
I responded in the wrong thread... :)
On Fri, Dec 16, 2011 at 2:56 PM, damien krotkine <dkrotkine@gmail.com>wrote:
Well your code will stil work, no need to change anything
On 16 December 2011 13:33, Nick Knutov <mail@knutov.com> wrote:
I always do something like
return redirect '/error/?reason=...' unless pass_all_checks()
I think I read in documentation or examples that it should be so and this way looks better - I can decide how it will work.
I think it's better to make accent on using 'return' when it needed, not changing behavior.
16.12.2011 18:16, damien krotkine пишет:
On 16 December 2011 12:57, Nick Knutov<mail@knutov.com> wrote:
+1.
As pass() and other.
Btw, are any reasons at all to halt the execution of the route
handler in
this functions?
There were a nasty security issue that if you uses a hook to catch the fact that a user is not authenticated for instance, the workflow would still continue in the rest of the route, so we needed a way to stop the execution of the route code block only.
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130
Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
Thank you sawyer for the quick release ! Envoyé de mon iPhone Le 17 déc. 2011 à 12:19, sawyer x <xsawyerx@gmail.com> a écrit : A new release (1.3091) is out on CPAN! It's got a few changes, most notably the return of the old template() call. Here is the changelog entry: 1.3091 17.12.2011 [ BUG FIXES ] * Reverting template() behavior by popular demand. (Damien Krotkine) * GH #714: Run post-request hooks when custom continuations were created. (Damien Krotkine) * Always call write_session_id() to update expires. (David Precious) [ ENHANCEMENTS ] * GH #711, #652: Add server_tokens variable to allow removal of headers. (John Wittkoski) [ DOCUMENTATION ] * GH #680: Document problems with multiple apps in Dancer using Plack::Handler::Apache2 and recommend a workaround. (Asaf Gordon, Pedro Melo) * RT #73258: Spelling glitches. (Damyan Ivanov) * Use ":script" instead of ":syntax" in Cookbook. (John Barrett) * Typos in Deployment doc. (David Precious) All in all, 5 tickets were resolved. Good job everyone! On Sat, Dec 17, 2011 at 11:26 AM, sawyer x <xsawyerx@gmail.com> wrote:
Whoops!
I responded in the wrong thread... :)
On Fri, Dec 16, 2011 at 2:56 PM, damien krotkine <dkrotkine@gmail.com>wrote:
Well your code will stil work, no need to change anything
On 16 December 2011 13:33, Nick Knutov <mail@knutov.com> wrote:
I always do something like
return redirect '/error/?reason=...' unless pass_all_checks()
I think I read in documentation or examples that it should be so and this way looks better - I can decide how it will work.
I think it's better to make accent on using 'return' when it needed, not changing behavior.
16.12.2011 18:16, damien krotkine пишет:
On 16 December 2011 12:57, Nick Knutov<mail@knutov.com> wrote:
+1.
As pass() and other.
Btw, are any reasons at all to halt the execution of the route
handler in
this functions?
There were a nasty security issue that if you uses a hook to catch the fact that a user is not authenticated for instance, the workflow would still continue in the rest of the route, so we needed a way to stop the execution of the route code block only.
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130
Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
_______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
The fix is now in the development branch, waiting for review and release. We'll keep you informed when it's done. thanks dams On 16 December 2011 11:35, David Precious <davidp@preshweb.co.uk> wrote:
Hi all,
Starting a new thread for visibility rather than responding in the "bug with multiple "template" calls ?" thread.
In 1.3090, template() (and some other keywords, e.g. pass(), halt() etc) now immediately halt execution of the route handler.
This made perfect sense for the other keywords affected, but for template(), it seems plenty of people are using template() in undocumented (but not incorrect) ways to generate emails etc, rather than intending the return value of template to be returned by their route handler immediately.
Since this is causing problems for people, we're going to reverse this change, better document the behaviour and usage of the template keyword, and get a new release out ASAP.
Sorry to those inconvenienced by this change - your complaints have been heard and listened to :)
Cheers
Dave P
-- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
participants (5)
-
damien krotkine -
David Precious -
Nick Knutov -
Richard Huxton -
sawyer x