title: Pylons - How to get the current controller and action (current route)?
body: <p>I'm in a Mako template, and I want to know what the current controller and action is (of the current page). How can I do this? I tried c.controller and c.action, but it didn't work. I also listed the keys of the context object but didn't find it.</p>
  
  <p>As a workaround, I've been setting c.controller and c.action from within each controller method, but I know there must be a better way.</p>
  
  <pre><code>class MainController(BaseController):
  
      def index(self):
          c.controller, c.action = 'main', 'index'
          return render("/main.html")
  </code></pre>