deskbar-applet r2071 - in trunk: . deskbar/core



Author: sebp
Date: Sun Apr  6 14:39:55 2008
New Revision: 2071
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=2071&view=rev

Log:
Added sanity checks to initialize_module and stop_module

Modified:
   trunk/ChangeLog
   trunk/deskbar/core/ModuleLoader.py

Modified: trunk/deskbar/core/ModuleLoader.py
==============================================================================
--- trunk/deskbar/core/ModuleLoader.py	(original)
+++ trunk/deskbar/core/ModuleLoader.py	Sun Apr  6 14:39:55 2008
@@ -166,6 +166,9 @@
         when done, passing the (now enabled) contextas argument.
         If module is already initialized, do nothing.
         """
+        if not isinstance(module, deskbar.interfaces.Module):
+            raise TypeError("Module is not a sub-class of deskbar.interfaces.Module")
+        
         if module.is_enabled():
             return
             
@@ -194,6 +197,8 @@
         instance is also set to None. Emits a 'module-stopped' signal when done passing
         the stopped module as argument.
         """
+        if not isinstance(module, deskbar.interfaces.Module):
+            raise TypeError("Module is not a sub-class of deskbar.interfaces.Module")
         
         LOGGER.info("Stopping %s", module.INFOS["name"])
         module.stop ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]