Thanks Michael a lot! It is exactly what I was looking for. It would be nice to see changes in Pyramid which make such customizations more developer friendly.
W dniu piątek, 8 lipca 2016 20:07:28 UTC+2 użytkownik Michael Merickel napisał: > > Easiest option is to just add a tween or NewResponse subscriber to your > app that handles responses from that url prefix. > > If you don't like hard-coding the url prefix, then another option is to > use a route factory on the static view which can annotate the request. You > can then use this info in a tween or NewResponse subscriber to determine > whether to set the header. I have a gist of this method here > https://gist.github.com/mmerickel/d9efb2ab358be75e6767 which you may find > useful. > > In the future I'd like to make the static view more extensible in this > regard. In 1.8 we are considering adding support for view derivers that > know about static views, so they can wrap them exclusively. You could then > define a view deriver for static views which could affect only their > responses with no performance impact on other views. > > There are a couple other tickets open with respect to wrapping the static > view response as well. > > https://github.com/Pylons/pyramid/issues/1489 > https://github.com/Pylons/pyramid/issues/2682 > > > On Fri, Jul 8, 2016 at 11:08 AM, Marcin Raczyński <[email protected] > <javascript:>> wrote: > >> I have static view configured: >> >> >> config.add_static_view(name='static', path='mypackage:assets') >> >> >> I want every static file response has header "X-Content-Type-Options". >> >> How can I do it? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "pylons-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pylons-discuss/f925aadb-8210-4841-8e32-c41abceb3164%40googlegroups.com >> >> <https://groups.google.com/d/msgid/pylons-discuss/f925aadb-8210-4841-8e32-c41abceb3164%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/45d6ffe2-c2c9-4d63-9e3a-e2e2b3b8b316%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
