On Wednesday, December 23, 2015 at 3:50:58 PM UTC-5, 
luis.vallada...@metamaxzone.com wrote:
>
> the first solution is a very good approach to my problem because i've a 
> considerable amount of python code inside my javascript, in fact if i 
> define variables for this content i will have between 80-120 vars per view. 
> But i still have one problem with this solution: For the navigator is 
> exactly like i have the code inline with my html and this mean that it'll 
> not be cached as a javascript file. It would be really good if the 
> navigator could cache this file.
>

If the content of the JS doesn't depend on other data associated with the 
page request, you could serve the JS via a separate request and cache it:

@cache.action(...)
def serve_js():
    response.view = 'views/js/%s' % request.args(0)
    return dict()

Then in your main view:

<script src="{{=URL('default', 'serve_js', args='my.js')}}"></script>

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to