How do I get my simple twisted proxy to work?

后端 未结 2 1180
逝去的感伤
逝去的感伤 2021-01-14 18:37

I am attempting to make use of the Twisted.Web framework.

Notice the three line comments (#line1, #line2, #line3). I want to create a proxy (gateway?) that will forw

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-14 18:47

    Since your Simple class implements the getChild() method, it is implied that this is not a leaf node, however, you are stating that it is a leaf node by setting isLeaf = True. (How can a leaf node have a child?).

    Try changing isLeaf = True to isLeaf = False and you'll find that it redirects to the proxy as you'd expect.

    From the Resource.getChild docstring:

    ... This will not be called if the class-level variable 'isLeaf' is set in
        your subclass; instead, the 'postpath' attribute of the request will be
        left as a list of the remaining path elements....
    

提交回复
热议问题