Alex, you lost me. Here is the start of my code for the render ------------------------------------- #This new html page for the calculation class rwrite(Resource): def render(self,request): request.setResponseCode(402) request.write(""" <html>
<head> <title>Equation solver</title> ------------------------------------------- I have a request.finish() at the end. It works OK in IE8. I get a "request.finish" done twice warning. I load it in FireFox and it kind of works. At times it displays html code and I refresh the screen and the apage shows. On Oct 2, 1:52 pm, Alex Clemesha <cleme...@gmail.com> wrote: > On Fri, Oct 2, 2009 at 10:12 AM, Mikie <thephantom6...@hotmail.com> wrote: > > > Alex, try > >http://pirsqr.com:2713/ > > and do the integral calculation. I had to use "request.write" in the > > posthandler and it produces the "Request did not return a string". I > > can't use "return", because the html page is in parts. > > The following should solved this problem: > > #do this import: > from twisted.web import server > > #now in your "render" method, do this: > > def render(self, request): > ... > d = some_method_that_returns_a_deferred(...) > d.addCallback(self.my_success_callback, request) > return server.NOT_DONE_YET > > def my_success_callback(self, request): > request.write(...) > request.finish() > > So that should be it. > > -Alex > > > > > > > On Oct 2, 6:27 am, "Dr. David Kirkby" <david.kir...@onetel.net> wrote: > >> Alex Clemesha wrote: > >> >> root = Resource() > >> >> root.putChild("foo", File("/tmp")) > >> >> root.putChild("bar", File("/lost+found")) > >> >> root.putChild("baz", File("/opt")) > >> >> root.putChild("varr", File("/var")) > >> >> root.putChild("buy", PaymentRequired()) > >> >> root.putChild("men", menu()) > >> >> factory = Site(root) > >> >> reactor.listenTCP(3333, factory) > >> >> reactor.run() > >> >> ---------------------------------------------- > >> >> It will not load the second page. > > >> > Do you mean that it will not load the page that > >> > shows the contents of "/lost+found"? Maybe there > >> > is a problem accessing that directory in the filesystem? > >> > Apologies if this is not the question you are asking. > > >> > -Alex > > >> lost+found would need root access in order to see the contents. It is > >> the place where files go when the file system gets in a mess, and as > >> such can contain other peoples files. > > >> dave- Hide quoted text - > > >> - Show quoted text - > > -- > Alex Clemesha > clemesha.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---