X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;ds=sidebyside;f=ipsilon%2Froot.py;h=daef90f3647ca85418031423133bec27f0174e5e;hb=cff71af03913b5b0987171205ef0c460b2f6fff8;hp=88a15c6080356eccfc92a2ec7187715ca4cc897d;hpb=4e4d0c1986ed37f6d2fc3553afce49fe700f5366;p=cascardo%2Fipsilon.git diff --git a/ipsilon/root.py b/ipsilon/root.py old mode 100755 new mode 100644 index 88a15c6..daef90f --- a/ipsilon/root.py +++ b/ipsilon/root.py @@ -1,27 +1,18 @@ -#!/usr/bin/python -# -# Copyright (C) 2013 Simo Sorce -# -# see file 'COPYING' for use and warranty information -# -# 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 . +# Copyright (C) 2013 Ipsilon project Contributors, for license see COPYING from ipsilon.util.page import Page +from ipsilon.util import errors from ipsilon.login.common import Login from ipsilon.login.common import Logout from ipsilon.admin.common import Admin -from ipsilon.unauthorized import Unauthorized +from ipsilon.providers.common import LoadProviders +from ipsilon.admin.loginstack import LoginStack +from ipsilon.admin.info import InfoPlugins +from ipsilon.admin.login import LoginPlugins +from ipsilon.admin.providers import ProviderPlugins +from ipsilon.rest.common import Rest +from ipsilon.rest.providers import RestProviderPlugins +import cherrypy sites = dict() @@ -29,21 +20,36 @@ sites = dict() class Root(Page): def __init__(self, site, template_env): - if not site in sites: + if site not in sites: sites[site] = dict() if template_env: sites[site]['template_env'] = template_env super(Root, self).__init__(sites[site]) + self.html_heads = dict() # set up error pages - self.unauthorized = Unauthorized(self._site) + cherrypy.config['error_page.400'] = errors.Error_400(self._site) + cherrypy.config['error_page.401'] = errors.Error_401(self._site) + cherrypy.config['error_page.404'] = errors.Error_404(self._site) + cherrypy.config['error_page.500'] = errors.Errors(self._site) # now set up the default login plugins self.login = Login(self._site) self.logout = Logout(self._site) + # set up idp providers now + LoadProviders(self, self._site) + # after all plugins are setup we can instantiate the admin pages - self.admin = Admin(self._site) + self.admin = Admin(self._site, 'admin') + self.rest = Rest(self._site, 'rest') + self.stack = LoginStack(self._site, self.admin) + LoginPlugins(self._site, self.stack) + InfoPlugins(self._site, self.stack) + ProviderPlugins(self._site, self.admin) + RestProviderPlugins(self._site, self.rest) def root(self): - return self._template('index.html', title='Ipsilon') + self.debug(self.html_heads) + return self._template('index.html', title='Ipsilon', + heads=self.html_heads)