If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


  • 0
    thadeusb  15 years ago
    The following works perfectly.. The broken javascript was to incorrect syntax, that for some reason when not minified, ran fine, but had a ton of errors when placed on one line, once those got situated out the javascript ran fine. However my end result is the following, it doesn't touch 'pre', 'blockquote', or 'textarea'. Size reduction is from 76.8KB to 66.5KB. Also another bug, is if you return any kind of json objects, or stream a download, the response._caller will override it and encode it into html (not good!) So a check must be made on what function is being called to see if it's ok to replace the caller. import re def save_pre(match): s = match.group() if s.startswith('|(?s)|(?s)') return cpat.sub(save_pre, response.render(d)) if request.controller not in ['',] \ and request.function not in ['preview_markdown', 'download', 'call']: response._caller = compress_response

Commented on:

Remove the excess blank lines that the web2py rendering engine puts in its output.

Hosting graciously provided by:
Python Anywhere