From bb77cefeaa94e79f45aaff869ed022e14e674280 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 6 May 2008 21:41:00 +0000 Subject: [PATCH] Possibly fixed a bug where IE 7 would fail to download as HTML via HTTPS due to cache issues. The fix entailed using a new @weakly_expire decorator on controller.Notebooks.download_html(). --- NEWS | 6 ++++++ controller/Expire.py | 14 ++++++++++++++ controller/Notebooks.py | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index ab54773..46b81e6 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +1.3.15: May 6, 2008 + * Fixed a bug where the "show on startup" checkbox did not appear checked if + you created a startup note, hid it, and then opened it the note tree area. + * Possibly fixed a bug where IE 7 would fail to download as HTML via HTTPS + due to cache issues. + 1.3.14: May 5, 2008 * Fixed a database indexing bug that prevented notes with really long (~2700+ character) titles from saving correctly. diff --git a/controller/Expire.py b/controller/Expire.py index 70d17b9..cac12b4 100644 --- a/controller/Expire.py +++ b/controller/Expire.py @@ -13,3 +13,17 @@ def strongly_expire( function ): return function( *args, **kwargs ) return expire + + +def weakly_expire( function ): + """ + Decorator that sends headers that instruct browsers and proxies not to cache. This cache busting + isn't as strong as the @strongly_expire decorator, but it has the distinct benefit of not + breaking Internet Explorer HTTPS file downloads. + """ + def expire( *args, **kwargs ): + cherrypy.response.headers[ "Expires" ] = "Sun, 19 Nov 1978 05:00:00 GMT" + + return function( *args, **kwargs ) + + return expire diff --git a/controller/Notebooks.py b/controller/Notebooks.py index 80f5b1d..00a0444 100644 --- a/controller/Notebooks.py +++ b/controller/Notebooks.py @@ -6,7 +6,7 @@ from Expose import expose from Validate import validate, Valid_string, Validation_error, Valid_bool, Valid_int from Database import Valid_id, Valid_revision, end_transaction from Users import grab_user_id, Access_error -from Expire import strongly_expire +from Expire import strongly_expire, weakly_expire from Html_nuker import Html_nuker from Html_differ import Html_differ from model.Notebook import Notebook @@ -974,7 +974,7 @@ class Notebooks( object ): ) @expose( view = Html_file ) - @strongly_expire + @weakly_expire @end_transaction @grab_user_id @validate(