def static(path): logger.info("[static]sending: %s" % (path, )) try: resp = Response(open(path).read()) if path.endswith(".ico"): resp.add_header(('Content-Type', "image/x-icon")) elif path.endswith(".html"): resp.add_header(('Content-Type', 'text/html')) elif path.endswith(".json"): resp.add_header(('Content-Type', 'application/json')) elif path.endswith(".txt"): resp.add_header(('Content-Type', 'text/plain')) elif path.endswith(".css"): resp.add_header(('Content-Type', 'text/css')) else: resp.add_header(('Content-Type', "text/xml")) return resp except IOError: return NotFound(path)