And FWIW, I just fixed it in the docs and created two pull requests: https://github.com/TurboGears/tg2docs/pulls
On Saturday, April 6, 2013 10:00:16 AM UTC+2, Moritz Schlarb wrote: > > First of all, you are totally right, there is a typo in the docs, there is > no controllers.py ever - it should say controllers/root.py instead. > > And on the other hand, for your understanding: > TurboGears uses a different approach than Flask, which uses explicitly > defined routes. > In TurboGears you have a so called Object Dispatch - which means that in > order to find the method to serve a request, > starting from the RootController, attributes that are subclasses of > TGController and methods with the @expose decorator > are searched for something the matches your request url (with some > wildcards, of course). > You can read more about that here: > > - > > https://turbogears.readthedocs.org/en/rtfd2.2.2/main/Controllers.html?highlight=object%20dispatch > - > > https://turbogears.readthedocs.org/en/rtfd2.2.2/main/TGControllers.html?highlight=object%20dispatch > - Or in the development docs, which are completely reordered and > overhauled: > > https://turbogears.readthedocs.org/en/development/turbogears/controllers.html#basic-dispatch > > So for your example, in order to see something at /hello, you add the > following to the RootController: > > @expose('hello.html') > def hello(self): > return dict() > > The method name is the url fragment that gets matched. > > Cheers, > Moritz > > On Saturday, April 6, 2013 5:13:15 AM UTC+2, Pronoy Chopra wrote: >> >> Hello, >> >> I just started with Turbogears 2.2 and I can't for the life of me find >> controllers.py as mentioned >> here<https://turbogears.readthedocs.org/en/rtfd2.2.2/main/explorequickstart.html#quick-example> >> >> I do see root.py in the controllers folder and I don't see any URLs to >> edit. Reason I point this out is, I've used Flask and it's pretty >> straightforward in there. You just do this: >> >> @app.route('/hello') >> def hello_handler(): >> return render_template('hello.html') >> >> So, hello_handler() is triggered when the URL '/hello' is called. So I am >> just trying to make sense according to my past experience. Please excuse >> the stupidity of the question if apparent. >> >> >> -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/turbogears?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

