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/sample3Plugin/sample3Plugin.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'plugins/plugin_examples/sample3Plugin') diff --git a/plugins/plugin_examples/sample3Plugin/sample3Plugin.py b/plugins/plugin_examples/sample3Plugin/sample3Plugin.py index cac5f70..d3a3f21 100644 --- a/plugins/plugin_examples/sample3Plugin/sample3Plugin.py +++ b/plugins/plugin_examples/sample3Plugin/sample3Plugin.py @@ -18,6 +18,8 @@ from pyfirstaidkit.returns import * from pyfirstaidkit.plugins import Plugin,Flow from pyfirstaidkit import Config +from pyfirstaidkit.issue import SimpleIssue +from pyfirstaidkit.reporting import PLUGIN import subprocess class Sample3Plugin(Plugin): @@ -28,9 +30,11 @@ class Sample3Plugin(Plugin): def __init__(self, *args, **kwargs): Plugin.__init__(self, *args, **kwargs) + self._issue = SimpleIssue(self.name, self.description) def prepare(self): # Prepare command line. + self._issue.set(detected = False, reporting = self._reporting, origin = self, level = PLUGIN) prepare = [self._path + "/plugin", "--task", "prepare"] proc = subprocess.Popen(prepare, stdout=subprocess.PIPE) (out, err) = proc.communicate() @@ -79,6 +83,7 @@ class Sample3Plugin(Plugin): self._result=ReturnFailure elif out[-4:] == "true": self._result=ReturnSuccess + self._issue.set(detected = True, happened = (self._result==ReturnFailure), reporting = self._reporting, origin = self, level = PLUGIN) def fix(self): fix = [self._path+"/plugin", "--task", "fix"] @@ -89,3 +94,5 @@ class Sample3Plugin(Plugin): self._result=ReturnFailure elif out[-4:] == "true": self._result=ReturnSuccess + self._issue.set(fixed = (self._result==ReturnSuccess), reporting = self._reporting, origin = self, level = PLUGIN) + -- cgit