Opened 10 years ago

Closed 10 years ago

#4412 defect closed wontfix (wontfix)

Unexpected resource on leaf postpath request

Reported by: kai Owned by:
Priority: normal Milestone:
Component: web Keywords:
Cc: Branch:
Author:

Description

Lets have a look at this example:

class Root(resource.Resource):
    pass

class Leaf(resource.Resource):
    isLeaf = 1
    def render(self, request):
        return "I'm a leaf resource"

root = Root()
root.putChild("leaf", Leaf())

Then, if you open url http://sometwistedurl.com/leaf - you'll see "I'm a leaf resource" message. But there is unexpected result if you open urls like:

I think the result should be - NoSuchResource, or something like that, but not the same resource as leaf.

Change History (2)

comment:1 Changed 10 years ago by Jean-Paul Calderone

Resolution: wontfix
Status: newclosed

Setting isLeaf to true has a well-defined meaning. The meaning is "stop resource traversal here and render this resource".

If you want a different behavior, then you don't want to use isLeaf. If you wanted a 404 for the 4 extra URLs you mention here, then not setting isLeaf to anything will give you exactly that behavior.

comment:2 Changed 9 years ago by <automation>

Owner: jknight deleted
Note: See TracTickets for help on using tickets.