how can I return some javascript code or a javascript file with view callables in Pyramid/Pylon framework?
You can do that as you'd do with any template/view callable. It's not that different. I'd still recommend setting the content type as such.
from pyramid.view import view_config
@view_config(name='javascript', renderer='templates/javascript.mako')
def my_js_view(request):
request.response.content_type = 'application/javascript'
return {... params ...}
It doesn't really differ from other views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With