custom traverser ate my routes

34 views
Skip to first unread message

bismigalis

unread,
Nov 27, 2012, 12:18:12 PM11/27/12
to pylons-...@googlegroups.com
Hi,
 i'm trying using custom traverser, i add it through config.add_traverser(MyCustomTraverser, MyRootClass)
also i have some routes like /login, /logout and one static_route.

Now when I go to this paths /login, /logout, /static/* they go througth this custom traverser, and not througth route system.

But from docs if there is any add_route directive first they must be considered, then start traverse algorithm.
When i comment config.add_traverser(MyCustomTraverser, MyRootClass) that routes work.

Michael Merickel

unread,
Nov 27, 2012, 12:32:09 PM11/27/12
to pylons-...@googlegroups.com

Traversal actually always happens. If a route is matched then traversal happens on the factory and path specified on the route. If unspecified, it will use the default root factory and the path "/". Thus under default conditions the context for a matched route is just the root of the default tree.

With this in mind you might have your root factory return a different tree if a route is matched (you could check for the presence of request.matched_route). This tree would not use your custom traverser.

You can always turn on pyramid.debug_routematch and other debugging to see what is going on as well.

Without seeing some code I can't help you diagnose "my routes don't work" but maybe now you have enough info to figure it out or paste something more useful for us.

bismigalis

unread,
Nov 28, 2012, 4:33:13 AM11/28/12
to pylons-...@googlegroups.com
Thanks Michael, now I got it. 
It is bug in my custom traverser.
I thought that if route match then traverser is not started. 
Reply all
Reply to author
Forward
0 new messages