but when I use a sniffer to check HTTP communication I can not see any
Expires
The header from the sniffer looks like this only
GET http://www.adomain.cz/ChangeProductList/ HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, application/vnd.ms-powerpoint,
application/msword, application/x-shockwave-flash, application/x-icq,
*/*
Referer: http://www.obchodujte.cz/ChangeProduct/17/
Accept-Language: en-us
Proxy-Connection: Keep-Alive
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host: www.obchodujte.cz
Pragma: no-cache
Cookie: sessionid=f6a4320bbcc80c09b1027ee2522063c2;
sessionid=f6a4320bbcc80c09b1027ee2522063c2
where can be a problem?
Thank you for help.
L.
That looks like you have just captured the HTTP request. You need to
capture the response.
Regards,
Malcolm
> Is there a way how to prevent a page from being cached?
from django.views.decorators.cache import never_cache
@never_cache
def myview(request):
# etc
I'm not sure if it's documented anywhere, I think it is.
Luke
--
"Mediocrity: It takes a lot less time, and most people don't realise
until it's too late." (despair.com)
Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/
Hey Luke,
I looked for the string 'never_cache' in my copy of the
'Sargasso'(pre-agic-removal) branch but didn't find anything. Do you know if
this feature is available there? Perhaps under a different name?
Thanks,
Eric.
>>> from django.views.decorators.cache import never_cache
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: cannot import name never_cache
Is it possible to change HTTP headers ,in Django,in this way below?
response= HttpResponseRedirect("/ChangeProductList/")
response['Pragma'] = "no cache"
response['Cache-Control'] = "no-cache,must-revalidate"
response['Pragma'] = "no cache"
response['Expires'] = "Wed, 11 Jan 2006 05:00:00 GMT"
return response
############
or how can I add /change HTTP headers in Django? (In Python it is very
easy)
Thank you for reply.
L
Decorators are just a convenient way of wrapping one function inside
another. You can still get all the functionality by just writing it
slightly differently. For reference, this Python 2.4 code
@some_decorator
def some_function(...):
...
is identical to this code (valid in Python 2.3, 2.4 and even earlier):
def some_function(...):
...
some_function = some_decorator(some_function)
See PEP 318 (http://www.python.org/dev/peps/pep-0318/ ) for all the
details if you care.
>
> Is it possible to change HTTP headers ,in Django,in this way below?
>
> response= HttpResponseRedirect("/ChangeProductList/")
> response['Pragma'] = "no cache"
> response['Cache-Control'] = "no-cache,must-revalidate"
> response['Pragma'] = "no cache"
> response['Expires'] = "Wed, 11 Jan 2006 05:00:00 GMT"
> return response
Yes, this you can alter HttpReponse objects (and their subclasses) like
this.
Regards,
Malcolm
> I looked for the string 'never_cache' in my copy of the
> 'Sargasso'(pre-agic-removal) branch but didn't find anything. Do you
> know if this feature is available there? Perhaps under a different
> name?
No, it's not there. However, most of its functionality is in
patch_response_headers, which I *guess* is in pre-magic-removal, though
I'm not sure where. So you could could backport the never_cache
function and stick it in your own code somewhere pretty easily - I
think everything you need is in these modules:
http://code.djangoproject.com/browser/django/trunk/django/views/decorators/cache.py
http://code.djangoproject.com/browser/django/trunk/django/utils/cache.py
Luke
--
"Mistakes: It could be that the purpose of your life is only to serve
as a warning to others." (despair.com)