Issue #4 invalid
Anonymous created an issue

Hi there,

I'm trying to understand something. I did something with handlers and subhandlers, that are nested in each other and have automatic routing and all... So I end with something like this:

('api/v1/', <wheezy.routing.router.PathRouter object at 0x10e0c0788>, None, 'sqla_ng_resource/venues'),
    ('venues', <class 'd2n.wheezy.sqla.crud.resource.ListHandler'>, None, 'venues/list')
    ('venues/{id_venue}', <class 'd2n.wheezy.sqla.crud.resource.ItemHandler'>, None, 'venues/item')
    ('venues/{id_venue}/', <wheezy.routing.router.PathRouter object at 0x105f92838>, None, 'sqla_ng_resource/venues/comments')
        ('comments', <class 'd2n.wheezy.sqla.crud.resource.ListHandler'>, None, 'venues/comments/list')
        ('comments/{id_comment}', <class 'd2n.wheezy.sqla.crud.resource.ItemHandler'>, None, 'venues/comments/item')

So I'm quite happy about this, it looks exactly how I wanted it. But even looking at the code I can't seem to understand why I can match: /api/v1/venues /api/v1/venues/1

without any problem but /api/v1/venues/1/comments or /api/v1/venues/1/comments/1 do not match...

I see that you have a TODO note here: https://bitbucket.org/akorn/wheezy.routing/src/ff53de17bb8f6d8bdf95f15d17ccc697e8d732ff/src/wheezy/routing/router.py?at=default#cl-122

I imagine it's linked to what I'm trying to do, isn't it?

Hehe any help would be much appreciated, I'll keep looking and post here if I find anything...

Comments (2)

  1. Andriy Kornatskyy repo owner

    Thanks. Actually add_routes should the only be accessible outside since it does necessary decision to call include for nested PathRouter or add_route for final end point. So the difference. I do not use it directly, instead like here and here.

  2. Log in to comment