Hm. Point. Garden paths are so much fun. what remain would then reduce to the question of how to not have the world accidentally see colorful raptorbarf (or about how to have a single exception/not_found template get generally used for multiple modes which can probably wait until I actually HAVE a Third Mode that I care about...)
On Sunday, June 5, 2016 at 4:00:29 PM UTC-7, Roger Crew wrote: > > > http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Rendering-exception-and-not_found-pages > > "You can also change the templates of those pages, since you most likely > want to show your users something more closely related to your application > in production. The renderer will always try to find > exception.$mode.$format.* ornot_found.$mode.$format.* before falling back > to the built-in default templates." > > There is a small problem here in that what I (and I suspect most people) > actually want > is to override the exception/not-found templates in ALL cases except > "development" mode, > because, in my case, at least, I'm paranoid about revealing stuff in ANY > non-development mode, > even the ones I might create accidentally by, say, mistyping something > like MOJO_MODE=producion, > which is why I don't like creating exception.production.html.ep > > but if I do the safe thing and create a general exception.html.ep > then I lose the built-in default templates for development mode, which I > really like/want. > > Thus far my workaround has been to symlink exception.development.html.ep > to the system-bundled one (and likewise for not_found), > which is rather unsatisfactory given that those can move around (and have) > which is then particularly fun since, given the CPAN installer's > well-known lack of ability to remove files when updating bundles, one can > go for months or years referncing an old file this way... > > Having been bitten by this a 2nd time, I now have a new workaround, > which is to have the first line of my exception.html.ep template be > > % return undef if app->mode eq 'development'; > > which actually works and, at first glance, > does seem to be the best way of having a template say, "oops I don't > actually exist after all" > and thus effectively providing the exception.NOT-development.html.ep file > that I want, > > but I'm still bothered by relying on undocumented behavior. > > Or I'm missing something basic and there is indeed a canonical way to do > what I want. > Or what I want is Just Wrong. > Or maybe you want to put this in the Cookbook. > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
