Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 1472:77942e0a12fe
open static files using binary mode [SF#693208]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 26 Feb 2003 04:57:50 +0000 |
| parents | 79d8956de3f5 |
| children | ed725179953d |
comparison
equal
deleted
inserted
replaced
| 1471:0e312b35996d | 1472:77942e0a12fe |
|---|---|
| 1 # $Id: client.py,v 1.99 2003-02-26 04:51:41 richard Exp $ | 1 # $Id: client.py,v 1.100 2003-02-26 04:57:49 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 |
| 447 mt = mimetypes.guess_type(str(file))[0] | 447 mt = mimetypes.guess_type(str(file))[0] |
| 448 if not mt: | 448 if not mt: |
| 449 mt = 'text/plain' | 449 mt = 'text/plain' |
| 450 self.additional_headers['Content-Type'] = mt | 450 self.additional_headers['Content-Type'] = mt |
| 451 self.additional_headers['Last-Modifed'] = rfc822.formatdate(lmt) | 451 self.additional_headers['Last-Modifed'] = rfc822.formatdate(lmt) |
| 452 self.write(open(filename).read()) | 452 self.write(open(filename, 'rb').read()) |
| 453 | 453 |
| 454 def renderContext(self): | 454 def renderContext(self): |
| 455 ''' Return a PageTemplate for the named page | 455 ''' Return a PageTemplate for the named page |
| 456 ''' | 456 ''' |
| 457 name = self.classname | 457 name = self.classname |
