TurboGears - MVC

sample というプロジェクトを作ると

sample/sample/controllers.py

ができて、これの中身を見ると

import turbogears as tg
from turbogears import controllers, expose, flash
# from sample import model
# import logging
# log = logging.getLogger("sample.controllers")

class Root(controllers.RootController):
    @expose(template="sample.templates.welcome")
    def index(self):
        import time
        # log.debug("Happy TurboGears Controller Responding For Duty")
        flash("Your application is now running")
        return dict(now=time.ctime())

となってる。直感的にも分かるけど、
http://localhost:8080/
にアクセスすると、Root#index が呼ばれる。テンプレートには @expose で指定されているファイルが使用され、return で指定された dictionary がマッピングされる模様。
rails みたいに「@ 地獄」にはならないで済むのか。こっちの方が好みだなぁ。
また、存在しないページ(メソッド)にアクセスした場合の挙動には default メソッドを定義する。

@expose()
def default(self, *args, **kw):
    return "This page is not ready"