-
Notifications
You must be signed in to change notification settings - Fork 1
Mapping code to a url
While trying to figure out what exactly some bit of code you're looking at does, or trying to test a bugfix, it's helpful to be able to visit pages that actually use the code in question.
First, let's take a look at how urls get mapped to controllers, as that will make the reverse process much easier to understand.
The first place to start is routing.py
. As the name suggests, this file contains the primary routing logic to decide what code should be called for each request. While Pylons has some documentation on the module, it's not terribly helpful; you'll probably find the routing section of the tutorial easier to understand.
From there, you should be pretty much set - match the controller
parameter to a file in the controllers
directory, and action
to a method in there, and it's on to normal code execution and tracing.
The backward process is a bit more difficult, since there is no trivial way to find mappings from definitions back to callsites. sgrep
, git grep
, grep
, and ack
are your friends, and hopefully you'll eventually work your way back to routing.py
.