def _makeDummyRequest(self, postpath, path, site): request = DummyRequest(postpath) if path is not None: request.path = path if site is not None: request.channel.site = site return request
def makeRequestForPath(site, path): """ @param site: a L{server.Site}. @param path: a C{str} URL-encoded path that starts with C{"/"}. @return: a request that requests C{path}. """ # Unquote URL with the same function that twisted.web.server uses. postpath = unquote(path).split('/') postpath.pop(0) dummyRequest = DummyRequest(postpath) dummyRequest.path = path dummyRequest.channel.site = site return dummyRequest