root.py
35 lines
| 1.6 KiB
| text/x-python
|
PythonLexer
Alessandro Molina
|
r6522 | # -*- coding: utf-8 -*- | ||
# This program is free software: you can redistribute it and/or modify | ||||
# it under the terms of the GNU General Public License as published by | ||||
# the Free Software Foundation, either version 3 of the License, or | ||||
# (at your option) any later version. | ||||
# | ||||
# This program is distributed in the hope that it will be useful, | ||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
# GNU General Public License for more details. | ||||
# | ||||
# You should have received a copy of the GNU General Public License | ||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
Mads Kiilerich
|
r7718 | from tg import config | ||
Alessandro Molina
|
r6522 | from tgext.routes import RoutedController | ||
Mads Kiilerich
|
r7718 | |||
Thomas De Schampheleire
|
r6530 | from kallithea.config.routing import make_map | ||
Mads Kiilerich
|
r7718 | from kallithea.controllers.error import ErrorController | ||
Alessandro Molina
|
r6522 | from kallithea.lib.base import BaseController | ||
Lars Kruse
|
r6789 | |||
Thomas De Schampheleire
|
r6530 | # This is the main Kallithea entry point; TurboGears will forward all requests | ||
# to an instance of 'controller.root.RootController' in the configured | ||||
# 'application' module (set by app_cfg.py). Requests are forwarded to | ||||
# controllers based on the routing mapper that lives in this root instance. | ||||
# The mapper is configured using routes defined in routing.py. This use of the | ||||
# 'mapper' attribute is a feature of tgext.routes, which is activated by | ||||
# inheriting from its RoutedController class. | ||||
Alessandro Molina
|
r6522 | class RootController(RoutedController, BaseController): | ||
Mads Kiilerich
|
r7752 | def __init__(self): | ||
self.mapper = make_map(config) | ||||
Thomas De Schampheleire
|
r6530 | |||
Mads Kiilerich
|
r7752 | # the following assignment hooks in error handling | ||
self.error = ErrorController() | ||||