From f12d5d6ac67cab511d1f15f41385afd10b8198da Mon Sep 17 00:00:00 2001 From: Martin Sivak Date: Tue, 18 Mar 2008 15:20:18 +0100 Subject: Add flag handling into the IssuesPlugin --- pyfirstaidkit/plugins.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pyfirstaidkit/plugins.py') diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py index 05464fe..9b25c7f 100644 --- a/pyfirstaidkit/plugins.py +++ b/pyfirstaidkit/plugins.py @@ -297,6 +297,7 @@ class IssuesPlugin(Plugin): Just fill the issue_tests list with classes describing the tests and let it run.""" issue_tests = [] #List of Issue classes to check + set_flags = [] #flags to set when everything is OK def __init__(self, *args, **kwargs): Plugin.__init__(self, *args, **kwargs) @@ -321,6 +322,8 @@ Just fill the issue_tests list with classes describing the tests and let it run. if result: self._result=ReturnSuccess + for flag in self.set_flags: + self._dependencies.provide(flag) else: self._result=ReturnFailure @@ -328,9 +331,17 @@ Just fill the issue_tests list with classes describing the tests and let it run. """Try to fix whatever is wrong in the system.""" result = False + fixed = True for i in self.tests: self._reporting.info(level = TASK, origin = self, message = "Fixing '%s'" % (i.name,)) result = result or i.fix() + i.reset() + if not i.detect() or i.happened(): + fixed = False + + if fixed: + for flag in self.set_flags: + self._dependencies.provide(flag) if result: self._result=ReturnSuccess -- cgit