On Wed, Sep 30, 2009 at 11:53 AM, Mikie <thephantom6...@hotmail.com> wrote:
>
> No, Alex.  It will not access the paymentRequired page.

Make this change and it should work:

class menu(Resource):
       def render_GET(self, request):
          request.setResponseCode(402)
          return "<html><body><a href='/buy'>Integrater</a></body></html>"


Note the " href='/buy'".

Does this work for you now?
-Alex





>
> On Sep 30, 11:28 am, Alex Clemesha <cleme...@gmail.com> 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
>>
>>
>>
>>
>>
>>
>>
>> > On Sep 29, 8:55 pm, William Stein <wst...@gmail.com> wrote:
>> >> On Tue, Sep 29, 2009 at 5:12 PM, Alex Clemesha <cleme...@gmail.com> wrote:
>>
>> >> > On Tue, Sep 29, 2009 at 4:42 PM, William Stein <wst...@gmail.com> wrote:
>>
>> >> >> On Tue, Sep 29, 2009 at 4:41 PM, Alex Clemesha <cleme...@gmail.com> 
>> >> >> wrote:
>>
>> >> >>> On Tue, Sep 29, 2009 at 8:26 AM, Mikie <thephantom6...@hotmail.com> 
>> >> >>> wrote:
>>
>> >> >>>> Does anyone have an example of a twisted server that loads 2 html
>> >> >>>> pages from a url?  
>> >> >>>> --www.twisted.com:8000/page1/,www.twisted.com:8000/page2/
>> >> >>>> Same port.
>> >> >>> Here are some very nice Twisted web tutorials:
>> >> >>>http://jcalderone.livejournal.com/tag/sixty+seconds
>>
>> >> >>> You'll be able to figure out you above question, and more,
>> >> >>> pretty easily from them.  Send another email if you're still having
>> >> >>> trouble after checking those out.
>>
>> >> >>> -Alex
>>
>> >> >> Alex, how hard is it to migrate from "Twisted.web2" which is used in
>> >> >> Sage back to "Twisted.web"?
>> >> > Pretty easily actually... the Resource object is pretty similar, the
>> >> > main difference is that the Web2 Resource object has the "locateChild" 
>> >> > method,
>> >> > where as the Web Resource has "getChild" - and even those are pretty 
>> >> > similar.
>>
>> >> > Also, there's some subtle differences in the way you doing
>> >> > "rendering"... i.e. with Web2 you subclass Resource/PostableResource 
>> >> > and then
>> >> > you use the "render" method, where are with Web you just subclass 
>> >> > Resource
>> >> > and implemented either "render_GET" or "render_POST".
>>
>> >> > Probably just looking through the examples here:
>> >> >http://jcalderone.livejournal.com/tag/sixty+seconds
>> >> > would be good enough to do the switch.
>>
>> >> > The Web code is being actively maintained and improved... One
>> >> > major improvement that will being going into Twisted 9.0 (due tomorrow 
>> >> > on
>> >> > the Twisted trac actually), is the nice WSGI support (for running
>> >> > Django, etc).
>> >> > In Codenode we use the trunk Web code, but in just a couple of days we
>> >> > will be able to remove all that code, and very cleanly run Django off a
>> >> > standard install of Twisted, which is extremely convenient.
>>
>> >> Thanks.  That was incredibly helpful and greatly appreciated.
>>
>> >> William- Hide quoted text -
>>
>> >> - Show quoted text -
>>
>> --
>> Alex Clemesha
>> clemesha.org- 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to