I am new to pylon and trying to understand this piece of code:
map.connect(':controller/:action/:id')
Any help would be much appreciated, thanks in advance!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s a generic route that tells pylons approximately to “Split up an incoming request url into three parts, try to find a controller classed named after the first path item, with a method named after the second. If that exists call it with the third path item as argument.” These kinds of paths are common for web API’s that expose database backed objects, where the ‘controller’ is the name of the model class, the ‘action’ is some method on that model, and ‘id’ would be the primary key of the database entity to be affected.
The routes logic in pylons exists as a python package of its own, with some in-depth documentation on how it can be used.