X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=blobdiff_plain;f=ipsilon%2Froot.py;h=413f4537d37849d9611b4b36788af47145757c9c;hp=a3526416333115a7b2cdd20bbfb26c0355f30a30;hb=b45786fa5c96cd18f6b62f1bb9a907f9da2e233b;hpb=84dcd4573e24b2a8901cecbe4ae15967564861e9 diff --git a/ipsilon/root.py b/ipsilon/root.py index a352641..413f453 100755 --- a/ipsilon/root.py +++ b/ipsilon/root.py @@ -17,10 +17,40 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from util import page +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.providers.common import LoadProviders import cherrypy -class Root(page.Page): +sites = dict() + + +class Root(Page): + + def __init__(self, site, template_env): + if not site in sites: + sites[site] = dict() + if template_env: + sites[site]['template_env'] = template_env + super(Root, self).__init__(sites[site]) + + # set up error pages + cherrypy.config['error_page.400'] = errors.Error_400(self._site) + cherrypy.config['error_page.401'] = errors.Error_401(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) def root(self): - return self._template('index.html', title='Root') + return self._template('index.html', title='Ipsilon')