|
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 $ |
2 | 2 |
|
3 | 3 | __doc__ = """ |
4 | 4 | WWW request handler (also used in the stand-alone server). |
@@ -229,7 +229,10 @@ def inner_main(self): |
229 | 229 | # we don't want clients caching our dynamic pages |
230 | 230 | self.additional_headers['Cache-Control'] = 'no-cache' |
231 | 231 | 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 |
233 | 236 |
|
234 | 237 | # render the content |
235 | 238 | self.write(self.renderContext()) |
@@ -463,9 +466,13 @@ def serve_static_file(self, file): |
463 | 466 | raise NotModified |
464 | 467 |
|
465 | 468 | # 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] |
467 | 471 | if not mt: |
468 | | - mt = 'text/plain' |
| 472 | + if file.endswith('.css'): |
| 473 | + mt = 'text/css' |
| 474 | + else: |
| 475 | + mt = 'text/plain' |
469 | 476 | self.additional_headers['Content-Type'] = mt |
470 | 477 | self.additional_headers['Last-Modifed'] = rfc822.formatdate(lmt) |
471 | 478 | self.write(open(filename, 'rb').read()) |
@@ -868,6 +875,9 @@ def passResetAction(self): |
868 | 875 | # pull the rego information out of the otk database |
869 | 876 | otk = self.form['otk'].value |
870 | 877 | uid = self.db.otks.get(otk, 'uid') |
| 878 | + if uid is None: |
| 879 | + self.error_message.append('Invalid One Time Key!') |
| 880 | + return |
871 | 881 |
|
872 | 882 | # re-open the database as "admin" |
873 | 883 | if self.user != 'admin': |
@@ -1305,7 +1315,8 @@ def searchAction(self): |
1305 | 1315 | else: |
1306 | 1316 | continue |
1307 | 1317 | else: |
1308 | | - if not self.form[key].value: continue |
| 1318 | + if not self.form[key].value: |
| 1319 | + continue |
1309 | 1320 | self.form.value.append(cgi.MiniFieldStorage('@filter', key)) |
1310 | 1321 |
|
1311 | 1322 | # handle saving the query params |
|
0 commit comments