Alex, just sent you an e-mail with code.
On Oct 2, 1:29 pm, Alex Clemesha <[email protected]> wrote:
> On Fri, Oct 2, 2009 at 12:24 PM, Mikie <[email protected]> wrote:
>
> > 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>
>
> How about trying to replace "render" with "render_GET",
> and then remove the request.write and instead just return the
> html string. Also, you probably dont want/need the
> "request.setResponseCode(402)",
> as that was just part of the examples you got it from, but not needed
> for what you are doing.
>
> If things still aren't working, maybe post your code in full
> somewhere like here:http://pastie.org/and I can take a look.
>
> -Alex
>
>
>
>
>
> > -------------------------------------------
> > 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 <[email protected]> wrote:
> >> On Fri, Oct 2, 2009 at 10:12 AM, Mikie <[email protected]> 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" <[email protected]> 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
>
> --
> Alex Clemesha
> clemesha.org- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---