import moksha

from tg import expose, flash, require, tmpl_context, redirect, validate
from repoze.what import predicates

from moksha import _
from moksha.model import DBSession
from moksha.lib.base import BaseController
from moksha.controllers.secc import AdminController
from moksha.api.widgets.layout import LayoutWidget

layout_widget = LayoutWidget('layout')

class RootController(BaseController):

    admin = AdminController()

    @expose('moksha.templates.widget')
    def index(self):
        tmpl_context.widget = layout_widget
        return dict()

    @expose('moksha.templates.widget')
    def widget(self, name):
        """ Display a widget by name """
        tmpl_context.widget = moksha.get_widget(name)
        return dict()

    @expose('moksha.templates.about')
    def about(self):
        return dict(page='about')

    @expose('moksha.templates.index')
    @require(predicates.has_permission('manage'))
    def manage_permission_only(self, **kw):
        return dict(page='managers stuff')

    @expose('moksha.templates.index')
    @require(predicates.is_user('editor'))
    def editor_user_only(self, **kw):
        return dict(page='editor stuff')

    @expose('moksha.templates.login')
    def login(self, **kw):
        came_from = kw.get('came_from', '/')
        return dict(page='login', header=lambda *arg: None,
                    footer=lambda *arg: None, came_from=came_from)

@@ -259,32 +259,85 @@
 AdminController%0A
+from moksha.controllers.error import ErrorController%0A
 from moksha.api.
@@ -480,16 +480,46 @@
 roller()
+%0A    error = ErrorController()
 %0A%0A    @e
@@ -1003,16 +1003,44 @@
 'manage'
+, msg=_('Only for managers')
 ))%0A    d

Add our ErrorController to the root, to sync up with the default TG2 quickstart