web/views/staticcontrollers.py
changeset 8427 63c4c65e4db1
parent 8389 94f26e3b09bf
child 8694 d901c36bcfce
equal deleted inserted replaced
8426:1cb51cdb4ce7 8427:63c4c65e4db1
    79         # Real production environment should use dedicated static file serving.
    79         # Real production environment should use dedicated static file serving.
    80         self._cw.set_header('last-modified', generateDateTime(os.stat(path).st_mtime))
    80         self._cw.set_header('last-modified', generateDateTime(os.stat(path).st_mtime))
    81         self._cw.validate_cache()
    81         self._cw.validate_cache()
    82         # XXX elif uri.startswith('/https/'): uri = uri[6:]
    82         # XXX elif uri.startswith('/https/'): uri = uri[6:]
    83         mimetype, encoding = mimetypes.guess_type(path)
    83         mimetype, encoding = mimetypes.guess_type(path)
       
    84         if mimetype is None:
       
    85             mimetype = 'application/octet-stream'
    84         self._cw.set_content_type(mimetype, osp.basename(path), encoding)
    86         self._cw.set_content_type(mimetype, osp.basename(path), encoding)
    85         with open(path, 'rb') as resource:
    87         with open(path, 'rb') as resource:
    86             return resource.read()
    88             return resource.read()
    87 
    89 
    88     @property
    90     @property