Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 1130:89bd02ffe4af
tell clients/caches not to cache our dynamic bits
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 12 Sep 2002 07:00:41 +0000 |
| parents | f7d798bc9344 |
| children | 36ec30d286ea |
comparison
equal
deleted
inserted
replaced
| 1129:f7d798bc9344 | 1130:89bd02ffe4af |
|---|---|
| 1 # $Id: client.py,v 1.30 2002-09-12 06:05:34 richard Exp $ | 1 # $Id: client.py,v 1.31 2002-09-12 07:00:41 richard Exp $ |
| 2 | 2 |
| 3 __doc__ = """ | 3 __doc__ = """ |
| 4 WWW request handler (also used in the stand-alone server). | 4 WWW request handler (also used in the stand-alone server). |
| 5 """ | 5 """ |
| 6 | 6 |
| 139 self.determine_context() | 139 self.determine_context() |
| 140 # possibly handle a form submit action (may change self.classname | 140 # possibly handle a form submit action (may change self.classname |
| 141 # and self.template, and may also append error/ok_messages) | 141 # and self.template, and may also append error/ok_messages) |
| 142 self.handle_action() | 142 self.handle_action() |
| 143 # now render the page | 143 # now render the page |
| 144 | |
| 145 # we don't want clients caching our dynamic pages | |
| 146 self.additional_headers['Cache-Control'] = 'no-cache' | |
| 147 self.additional_headers['Pragma'] = 'no-cache' | |
| 148 self.additional_headers['Expires'] = 'Thu, 1 Jan 1970 00:00:00 GMT' | |
| 149 | |
| 144 if self.form.has_key(':contentonly'): | 150 if self.form.has_key(':contentonly'): |
| 145 # just the content | 151 # just the content |
| 146 self.write(self.content()) | 152 self.write(self.content()) |
| 147 else: | 153 else: |
| 148 # render the content inside the page template | 154 # render the content inside the page template |
| 407 ''' | 413 ''' |
| 408 if headers is None: | 414 if headers is None: |
| 409 headers = {'Content-Type':'text/html'} | 415 headers = {'Content-Type':'text/html'} |
| 410 if response is None: | 416 if response is None: |
| 411 response = self.response_code | 417 response = self.response_code |
| 418 | |
| 419 # update with additional info | |
| 412 headers.update(self.additional_headers) | 420 headers.update(self.additional_headers) |
| 421 | |
| 413 if not headers.has_key('Content-Type'): | 422 if not headers.has_key('Content-Type'): |
| 414 headers['Content-Type'] = 'text/html' | 423 headers['Content-Type'] = 'text/html' |
| 415 self.request.send_response(response) | 424 self.request.send_response(response) |
| 416 for entry in headers.items(): | 425 for entry in headers.items(): |
| 417 self.request.send_header(*entry) | 426 self.request.send_header(*entry) |
