[web2py] Re: Is there any way to preprocess a view before its rendered?

2019-02-08 Thread Alfonso Serra
This would be a solution: At gluon/templates.py line 790, poll for "*response.parseview*" which is a custom function that will get the template text and return a modified one: else: text = filename.read() response = context.get("response") if response and

[web2py] Re: Is there any way to preprocess a view before its rendered?

2019-02-08 Thread Alfonso Serra
Those are all good alternatives. ill investigate the js option but cant process a view with js delimiters as \{{ as they will be interepreted by python. response.render is not documented but found an example at

[web2py] Re: Is there any way to preprocess a view before its rendered?

2019-02-08 Thread Anthony
It's just a file, so read it in, do whatever you want with it, and then call response.render() with the results. A simpler approach is to see if you can use alternative delimiters with your JS library. If the library doesn't allow that, you can use alternative delimiters in the original code,