I have a generic layout.mako, but want to make it in code:
append some html to all responses generated by my controllers (even
those that do not use mako_render and just return html string).
I'm trying to modify BaseController.__call__ function this way:
res = WSGIController.__call__(self, environ, start_response)
if response.content_type == 'text/html' and type(res) is list:
res.append('<script>alert("It works!");</script>')
return res
It actually works, sometime (1 of 5 times I press F5). Not sure why.
Am I missing anything here? How do I append generic content to all
responses?
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.