def translate(self, request): """Given a Request, return a filesystem path, or raise Response. """ # First step. # =========== # Set request.fs initially, return a list of fspath parts. parts = gauntlet.translate(request) log.debug("got request for " + request.fs) # The Gauntlet # ============ # Keep request.fs up to date for logging purposes. It is used in # log_access, below, which could be triggered by any of the raises # herein. Each of these sets request.fs, and returns None or raises. gauntlet.check_sanity(request) gauntlet.hidden_files(request) gauntlet.virtual_paths(request, parts) gauntlet.trailing_slash(request) gauntlet.index(request) gauntlet.autoindex( request , self.opts.no('list_directories') , self.ours_or_theirs('autoindex.html') ) gauntlet.socket_files(request) gauntlet.not_found(request, self.find_ours('favicon.ico')) # Now you are one of us. # ====================== return request.fs
def check_index(path): """Given an urlpath, return a filesystem path per gauntlet.virtual_paths. """ request = StubRequest(path) parts = gauntlet.translate(request) gauntlet.index(request) return request