summaryrefslogtreecommitdiffstats
path: root/ipsilon/providers
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-06-27 20:26:22 -0400
committerPatrick Uiterwijk <puiterwijk@redhat.com>2014-08-27 18:15:03 -0400
commit71edd1146556eecb9f9375da46313e94bf82874c (patch)
tree53588020013cf89dd0393f05e24f77f17896af01 /ipsilon/providers
parent734323ca25765e6eecfa63e41b7f3ec12b084ca3 (diff)
downloadipsilon-71edd1146556eecb9f9375da46313e94bf82874c.tar.gz
ipsilon-71edd1146556eecb9f9375da46313e94bf82874c.tar.xz
ipsilon-71edd1146556eecb9f9375da46313e94bf82874c.zip
Use new Log class everywhere
Replace copies of _debug function sprinkled all over the code with a single implementation Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com> - Removed replace of self._debug to self.debug
Diffstat (limited to 'ipsilon/providers')
-rwxr-xr-xipsilon/providers/common.py17
-rwxr-xr-xipsilon/providers/saml2/provider.py14
2 files changed, 6 insertions, 25 deletions
diff --git a/ipsilon/providers/common.py b/ipsilon/providers/common.py
index b1eab1a..94f747a 100755
--- a/ipsilon/providers/common.py
+++ b/ipsilon/providers/common.py
@@ -17,13 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from ipsilon.util.log import Log
from ipsilon.util.plugin import PluginLoader, PluginObject
from ipsilon.util.plugin import PluginInstaller
from ipsilon.util.page import Page
import cherrypy
-class ProviderException(Exception):
+class ProviderException(Exception, Log):
def __init__(self, message):
super(ProviderException, self).__init__(message)
@@ -32,10 +33,6 @@ class ProviderException(Exception):
def __str__(self):
return repr(self.message)
- def _debug(self, fact):
- if cherrypy.config.get('debug', False):
- cherrypy.log('%s: %s' % (self.__class__.__name__, fact))
-
class ProviderBase(PluginObject):
@@ -46,10 +43,6 @@ class ProviderBase(PluginObject):
self.tree = None
self.admin = None
- def _debug(self, fact):
- if cherrypy.config.get('debug', False):
- cherrypy.log(fact)
-
def get_tree(self, site):
raise NotImplementedError
@@ -136,7 +129,7 @@ class ProviderPageBase(Page):
FACILITY = 'provider_config'
-class LoadProviders(object):
+class LoadProviders(Log):
def __init__(self, root, site):
loader = PluginLoader(LoadProviders, FACILITY, 'IdpProvider')
@@ -151,10 +144,6 @@ class LoadProviders(object):
plugin = providers['available'][item]
plugin.register(site)
- def _debug(self, fact):
- if cherrypy.config.get('debug', False):
- cherrypy.log(fact)
-
class ProvidersInstall(object):
diff --git a/ipsilon/providers/saml2/provider.py b/ipsilon/providers/saml2/provider.py
index 8b7f04e..58ffbfe 100755
--- a/ipsilon/providers/saml2/provider.py
+++ b/ipsilon/providers/saml2/provider.py
@@ -19,7 +19,7 @@
from ipsilon.providers.common import ProviderException
from ipsilon.tools.saml2metadata import SAML2_NAMEID_MAP
-import cherrypy
+from ipsilon.util.log import Log
import lasso
@@ -42,7 +42,7 @@ class NameIdNotAllowed(Exception):
return repr(self.message)
-class ServiceProvider(object):
+class ServiceProvider(Log):
def __init__(self, config, provider_id):
self.cfg = config
@@ -135,10 +135,6 @@ class ServiceProvider(object):
idval = data.keys()[0]
self.cfg.del_datum(idval)
- def _debug(self, fact):
- if cherrypy.config.get('debug', False):
- cherrypy.log(fact)
-
def normalize_username(self, username):
if 'strip domain' in self._properties:
return username.split('@', 1)[0]
@@ -185,7 +181,7 @@ class ServiceProviderCreator(object):
return ServiceProvider(self.cfg, spid)
-class IdentityProvider(object):
+class IdentityProvider(Log):
def __init__(self, config):
self.server = lasso.Server(config.idp_metadata_file,
config.idp_key_file,
@@ -206,7 +202,3 @@ class IdentityProvider(object):
def get_providers(self):
return self.server.get_providers()
-
- def _debug(self, fact):
- if cherrypy.config.get('debug', False):
- cherrypy.log(fact)