Skip to content

Commit af64611

Browse files
author
Richard Jones
committed
cgi fixes
1 parent 7a7dbbf commit af64611

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

roundup/cgi/client.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.109 2003-03-20 04:02:52 richard Exp $
1+
# $Id: client.py,v 1.110 2003-03-26 03:35:00 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -229,7 +229,10 @@ def inner_main(self):
229229
# we don't want clients caching our dynamic pages
230230
self.additional_headers['Cache-Control'] = 'no-cache'
231231
self.additional_headers['Pragma'] = 'no-cache'
232-
self.additional_headers['Expires'] = 'Thu, 1 Jan 1970 00:00:00 GMT'
232+
233+
# expire this page 5 seconds from now
234+
date = rfc822.formatdate(time.time() + 5)
235+
self.additional_headers['Expires'] = date
233236

234237
# render the content
235238
self.write(self.renderContext())
@@ -463,9 +466,13 @@ def serve_static_file(self, file):
463466
raise NotModified
464467

465468
# we just want to serve up the file named
466-
mt = mimetypes.guess_type(str(file))[0]
469+
file = str(file)
470+
mt = mimetypes.guess_type(file)[0]
467471
if not mt:
468-
mt = 'text/plain'
472+
if file.endswith('.css'):
473+
mt = 'text/css'
474+
else:
475+
mt = 'text/plain'
469476
self.additional_headers['Content-Type'] = mt
470477
self.additional_headers['Last-Modifed'] = rfc822.formatdate(lmt)
471478
self.write(open(filename, 'rb').read())
@@ -868,6 +875,9 @@ def passResetAction(self):
868875
# pull the rego information out of the otk database
869876
otk = self.form['otk'].value
870877
uid = self.db.otks.get(otk, 'uid')
878+
if uid is None:
879+
self.error_message.append('Invalid One Time Key!')
880+
return
871881

872882
# re-open the database as "admin"
873883
if self.user != 'admin':
@@ -1305,7 +1315,8 @@ def searchAction(self):
13051315
else:
13061316
continue
13071317
else:
1308-
if not self.form[key].value: continue
1318+
if not self.form[key].value:
1319+
continue
13091320
self.form.value.append(cgi.MiniFieldStorage('@filter', key))
13101321

13111322
# handle saving the query params

0 commit comments

Comments
 (0)