Use new Log class everywhere
[cascardo/ipsilon.git] / ipsilon / providers / common.py
index b1eab1a..94f747a 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # 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
 
 
 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)
 
     def __init__(self, message):
         super(ProviderException, self).__init__(message)
@@ -32,10 +33,6 @@ class ProviderException(Exception):
     def __str__(self):
         return repr(self.message)
 
     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):
 
 
 class ProviderBase(PluginObject):
 
@@ -46,10 +43,6 @@ class ProviderBase(PluginObject):
         self.tree = None
         self.admin = None
 
         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
 
     def get_tree(self, site):
         raise NotImplementedError
 
@@ -136,7 +129,7 @@ class ProviderPageBase(Page):
 FACILITY = 'provider_config'
 
 
 FACILITY = 'provider_config'
 
 
-class LoadProviders(object):
+class LoadProviders(Log):
 
     def __init__(self, root, site):
         loader = PluginLoader(LoadProviders, FACILITY, 'IdpProvider')
 
     def __init__(self, root, site):
         loader = PluginLoader(LoadProviders, FACILITY, 'IdpProvider')
@@ -151,10 +144,6 @@ class LoadProviders(object):
             plugin = providers['available'][item]
             plugin.register(site)
 
             plugin = providers['available'][item]
             plugin.register(site)
 
-    def _debug(self, fact):
-        if cherrypy.config.get('debug', False):
-            cherrypy.log(fact)
-
 
 class ProvidersInstall(object):
 
 
 class ProvidersInstall(object):