From dda25ee4e1ca17cd333f10fcf0c825b60105da9c Mon Sep 17 00:00:00 2001 From: Martin Sivak Date: Mon, 5 May 2008 15:46:38 +0200 Subject: Use Issue reporting in plugins --- plugins/plugin_examples/dep2.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/plugin_examples/dep2.py') diff --git a/plugins/plugin_examples/dep2.py b/plugins/plugin_examples/dep2.py index e8e8f43..1a0e0fd 100644 --- a/plugins/plugin_examples/dep2.py +++ b/plugins/plugin_examples/dep2.py @@ -17,6 +17,8 @@ from pyfirstaidkit.plugins import Plugin,Flow from pyfirstaidkit.returns import * +from pyfirstaidkit.reporting import PLUGIN +from pyfirstaidkit.issue import SimpleIssue class Sample1Plugin(Plugin): """This plugin uses the predefined flow in the Plugin abstract class.""" @@ -25,6 +27,7 @@ class Sample1Plugin(Plugin): author = "Joel Andres Granados" def __init__(self, *args, **kwargs): Plugin.__init__(self, *args, **kwargs) + self._issue = SimpleIssue(self.name, self.description) @classmethod def getDeps(cls): @@ -32,6 +35,7 @@ class Sample1Plugin(Plugin): def prepare(self): self._result=ReturnSuccess + self._issue.set(detected = False, reporting = self._reporting, origin = self, level = PLUGIN) def backup(self): self._result=ReturnSuccess @@ -41,9 +45,11 @@ class Sample1Plugin(Plugin): def diagnose(self): self._result=ReturnSuccess + self._issue.set(detected = True, happened = False, reporting = self._reporting, origin = self, level = PLUGIN) def fix(self): self._result=ReturnFailure + self._issue.set(fixed = False, reporting = self._reporting, origin = self, level = PLUGIN) def clean(self): self._result=ReturnSuccess -- cgit