Okay this is a really great idea and i can use it perfectly, but i wonder 
(only for making it easy to me) if there is a way to do this with a 
javascript that depends of the data associated with the page request? maybe 
a way to pass all the params recieved by the view from the controller to my 
server_js method in order to pass this parameters also to the .js file.

El miércoles, 23 de diciembre de 2015, 16:31:52 (UTC-4:30), Anthony 
escribió:
>
> On Wednesday, December 23, 2015 at 3:50:58 PM UTC-5, 
> luis.va...@metamaxzone.com <javascript:> 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