def filter(self, webRoot, req): # req - (clientAddress, headers, method, path, query) result = True, 200, "", [] if re.match("^/restricted_area(/|$)", req.path): result = False, 403, "This is restricted area.", [] else: ext = os.path.basename(req.path).split(".")[-1] if ext == "py": _webRoot = webRoot if webRoot[-1] != "/" else webRoot[:-1] script_path = _webRoot + req.path if os.path.exists(script_path): mod = SFL("mod", script_path).load_module() try: s = mod.do(req) result = False, 200, s, [] except: pass return result