Skip to content

Commit fb550fd

Browse files
author
Alexander Smishlajev
committed
disallow caching of pages with error and/or ok messages.
add vim modeline.
1 parent be6bf2a commit fb550fd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

roundup/cgi/client.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.188 2004-10-07 23:13:11 richard Exp $
1+
# $Id: client.py,v 1.189 2004-10-20 06:30:32 a1s Exp $
22

33
"""WWW request handler (also used in the stand-alone server).
44
"""
@@ -234,9 +234,18 @@ def inner_main(self):
234234
# Pragma: no-cache makes Mozilla and its ilk double-load all pages!!
235235
# self.additional_headers['Pragma'] = 'no-cache'
236236

237-
# expire this page 5 seconds from now
238-
date = rfc822.formatdate(time.time() + 5)
239-
self.additional_headers['Expires'] = date
237+
# pages with messages added expire right now
238+
# simple views may be cached for a small amount of time
239+
# TODO? make page expire time configurable
240+
if self.error_message or self.ok_message:
241+
date = time.time() - 1
242+
else:
243+
date = time.time() + 5
244+
self.additional_headers['Expires'] = date
245+
246+
247+
date = time.time() + 5
248+
self.additional_headers['Expires'] = rfc822.formatdate(date)
240249

241250
# render the content
242251
self.write_html(self.renderContext())
@@ -814,3 +823,4 @@ def standard_message(self, to, subject, body, author=None):
814823
def parsePropsFromForm(self, create=0):
815824
return FormParser(self).parse(create=create)
816825

826+
# vim: set et sts=4 sw=4 :

0 commit comments

Comments
 (0)