diff options
| author | Joel Andres Granados <jgranado@redhat.com> | 2007-11-20 14:02:16 +0100 |
|---|---|---|
| committer | Joel Andres Granados <jgranado@redhat.com> | 2007-11-20 14:02:16 +0100 |
| commit | 0ead822b85428109f6089a0167c70db0fab4f9de (patch) | |
| tree | 5b5887efd1f9e34797e98d293faf01afa82e2e5c /tasker/plugins.py | |
| parent | 568b29eab782ebebe0fbae90cb3e2ca83f897977 (diff) | |
| download | firstaidkit-0ead822b85428109f6089a0167c70db0fab4f9de.tar.gz firstaidkit-0ead822b85428109f6089a0167c70db0fab4f9de.tar.xz firstaidkit-0ead822b85428109f6089a0167c70db0fab4f9de.zip | |
Lets use Plugin as an abstract class.
Diffstat (limited to 'tasker/plugins.py')
| -rw-r--r-- | tasker/plugins.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/tasker/plugins.py b/tasker/plugins.py index d9ef0ce..aa9d0d9 100644 --- a/tasker/plugins.py +++ b/tasker/plugins.py @@ -89,8 +89,9 @@ class Plugin(object): All the actions that must be done before the execution of any plugin function. This function generaly addresses things that are global to the plugin. """ - self._result = True - return True + #We want these functions to be overridden by the plugin developer. + if self.__class__ is Plugin: + raise TypeError, "Plugin is an abstract class." def destroy(self): """Final actions. @@ -99,28 +100,33 @@ class Plugin(object): This function generaly addresses things that are global and need to be closed off, like file descriptos, or mounted partitions.... """ - self._result = True - return True + #We want these functions to be overridden by the plugin developer. + if self.__class__ is Plugin: + raise TypeError, "Plugin is an abstract class." def backup(self): """Gather important information needed for restore.""" - self._result = True - return True + #We want these functions to be overridden by the plugin developer. + if self.__class__ is Plugin: + raise TypeError, "Plugin is an abstract class." def restore(self): """Try to restore the previous state described in backup.""" - self._result = True - return True + #We want these functions to be overridden by the plugin developer. + if self.__class__ is Plugin: + raise TypeError, "Plugin is an abstract class." def diagnose(self): """Diagnose the situation.""" - self._result = True #the system is OK - return self._result + #We want these functions to be overridden by the plugin developer. + if self.__class__ is Plugin: + raise TypeError, "Plugin is an abstract class." def fix(self): """Try to fix whatever is wrong in the system.""" - self._result = False - return False + #We want these functions to be overridden by the plugin developer. + if self.__class__ is Plugin: + raise TypeError, "Plugin is an abstract class." class BinPlugin(Plugin): def __init__(self, bin): |
