From: Simo Sorce Date: Mon, 21 Apr 2014 02:00:08 +0000 (-0400) Subject: Convert all forms to use util.Page form support X-Git-Tag: v0.2.2~15 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=commitdiff_plain;h=d7e4bbbf32e5bfae87bfa686fbb5f86efcb04ee1;ds=sidebyside Convert all forms to use util.Page form support This way all forms will get Referer checking automaticaly Signed-off-by: Simo Sorce --- diff --git a/ipsilon/admin/common.py b/ipsilon/admin/common.py index 18b71ab..424103e 100755 --- a/ipsilon/admin/common.py +++ b/ipsilon/admin/common.py @@ -26,7 +26,7 @@ from ipsilon.util.page import admin_protect class AdminPluginPage(Page): def __init__(self, obj, site, parent): - super(AdminPluginPage, self).__init__(site) + super(AdminPluginPage, self).__init__(site, form=True) self._obj = obj self.title = '%s plugin' % obj.name self.url = '%s/%s' % (parent.url, obj.name) @@ -89,12 +89,6 @@ class AdminPluginPage(Page): menu=self.menu, action=self.url, options=self.plugin_config) - def root(self, *args, **kwargs): - cherrypy.log.error("method: %s" % cherrypy.request.method) - op = getattr(self, cherrypy.request.method, self.GET) - if callable(op): - return op(*args, **kwargs) - class Admin(Page): diff --git a/ipsilon/admin/login.py b/ipsilon/admin/login.py index d11c1f1..70b477f 100755 --- a/ipsilon/admin/login.py +++ b/ipsilon/admin/login.py @@ -28,7 +28,7 @@ from ipsilon.login.common import FACILITY class LoginPluginsOrder(Page): def __init__(self, site, parent): - super(LoginPluginsOrder, self).__init__(site) + super(LoginPluginsOrder, self).__init__(site, form=True) self.url = '%s/order' % parent.url self.menu = [parent] @@ -91,12 +91,6 @@ class LoginPluginsOrder(Page): menu=self.menu, action=self.url, options=self._site[FACILITY]['enabled']) - def root(self, *args, **kwargs): - cherrypy.log.error("method: %s" % cherrypy.request.method) - op = getattr(self, cherrypy.request.method, self.GET) - if callable(op): - return op(*args, **kwargs) - class LoginPlugins(Page): def __init__(self, site, parent): diff --git a/ipsilon/providers/saml2/admin.py b/ipsilon/providers/saml2/admin.py index 0a5a88d..4f33e1b 100755 --- a/ipsilon/providers/saml2/admin.py +++ b/ipsilon/providers/saml2/admin.py @@ -31,7 +31,7 @@ VALID_IN_NAME = r'[^\ a-zA-Z0-9]' class NewSPAdminPage(Page): def __init__(self, site, parent): - super(NewSPAdminPage, self).__init__(site) + super(NewSPAdminPage, self).__init__(site, form=True) self.parent = parent self.title = 'New Service Provider' self.backurl = parent.url @@ -103,11 +103,6 @@ class NewSPAdminPage(Page): return self.form_new(message, message_type) - def root(self, *args, **kwargs): - op = getattr(self, cherrypy.request.method, self.GET) - if callable(op): - return op(*args, **kwargs) - class InvalidValueFormat(Exception): pass @@ -120,7 +115,7 @@ class UnauthorizedUser(Exception): class SPAdminPage(Page): def __init__(self, sp, site, parent): - super(SPAdminPage, self).__init__(site) + super(SPAdminPage, self).__init__(site, form=True) self.parent = parent self.sp = sp self.title = sp.name @@ -259,11 +254,6 @@ class SPAdminPage(Page): return self.form_standard(message, message_type) - def root(self, *args, **kwargs): - op = getattr(self, cherrypy.request.method, self.GET) - if callable(op): - return op(*args, **kwargs) - def delete(self): self.parent.del_sp(self.sp.name) self.sp.permanently_delete()