def guess_type(self, path): ctype = CGIHTTPRequestHandler.guess_type(self, path) # I had the case where the mimetype associated with .js in the Windows # registery was text/plain... if os.path.splitext(path)[1] == ".js": ctype = "application/javascript" return ctype
def translate_path(self, path): """For paths starting with /cgi-bin/, serve from cgi_dir""" elts = path.split('/') if len(elts) > 1 and elts[0] == '': if elts[1] == 'cpython_site_packages': elts[-1] = elts[-1].split("?")[0] return os.path.join(cpython_site_packages, *elts[2:]) return CGIHTTPRequestHandler.translate_path(self, path)
def translate_path(self, path): """For paths starting with /cgi-bin/, serve from cgi_dir""" elts = path.split('/') if len(elts) > 1 and elts[0] == '' and elts[1] == 'cgi-bin': return os.path.join(cgi_dir, *elts[2:]) return CGIHTTPRequestHandler.translate_path(self, path)