Re: Using Django's Cache

2009-07-20 Thread Daniel Roseman

On Jul 20, 5:49 pm, WilsonOfCanada  wrote:
> Well then I will have to try a different approach.  When using
> render_to_response('webpage.html', d), I have d as a dictionary.  I
> was wondering if you send a whole text file as a part of the
> dictionary.
>
> For example:
>
> fileView = open('C://path//main_cities.txt', 'r+')
> d['main_cities'] = fileView
> render_to_response('webpage.html', d)
>
> Thanks

There is probably a way to do this via javascript and relying on the
normal browser cache.

If you make the text file available through your asset server, along
with your css and js files, you could get your javascript to request
it via an Ajax/XMLHTTPRequest call. I'm pretty sure the following
times it was requested, the browser cache would be used - just like
when you request a CSS file which hasn't changed, the version in the
browser cache is used rather than the entire file having to be
transferred again.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using Django's Cache

2009-07-20 Thread Luke Seelenbinder

That is entirely possible; however, it might slow down the rendering
of the template, because you simply have more to handle.

Luke

On Jul 20, 12:49 pm, WilsonOfCanada  wrote:
> Well then I will have to try a different approach.  When using
> render_to_response('webpage.html', d), I have d as a dictionary.  I
> was wondering if you send a whole text file as a part of the
> dictionary.
>
> For example:
>
> fileView = open('C://path//main_cities.txt', 'r+')
> d['main_cities'] = fileView
> render_to_response('webpage.html', d)
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using Django's Cache

2009-07-20 Thread WilsonOfCanada

Well then I will have to try a different approach.  When using
render_to_response('webpage.html', d), I have d as a dictionary.  I
was wondering if you send a whole text file as a part of the
dictionary.

For example:

fileView = open('C://path//main_cities.txt', 'r+')
d['main_cities'] = fileView
render_to_response('webpage.html', d)

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using Django's Cache

2009-07-19 Thread Alex Gaynor

On Sun, Jul 19, 2009 at 1:05 PM, WilsonOfCanada wrote:
>
> Hellos,
>
> I was wondering if I can use Django caching system to store .txt
> or .img files on the client side (as temp file).  I want to use
> javascript to use them later so it would not require to transfer files
> from the server again.  The txt files are just list so there is
> nothing about security, but they are just very long.
>
> thanks
> >
>

There is no way to access a users temporary files.  Django's cache
system is exclusively on the backend.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---