def render(self, req): self._req = req self._stillAlive = True if hasattr(req, 'notifyFinish'): req.notifyFinish().addErrback(self.connectionLost) d = autotimer.parseEPGAsync().addCallback(self.epgCallback).addErrback(self.epgErrback) def timeout(): if not d.called and self._stillAlive: reactor.callFromThread(lambda: req.write("<ignore />")) reactor.callLater(50, timeout) reactor.callLater(50, timeout) req.setResponseCode(http.OK) req.setHeader('Content-type', 'application/xhtml+xml') req.setHeader('charset', 'UTF-8') req.write("""<?xml version=\"1.0\" encoding=\"UTF-8\" ?><e2simplexmlresult>""") return server.NOT_DONE_YET