thomas - in flumotion/trunk: . flumotion/component

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Mon Apr 14 23:01:42 CEST 2008


Author: thomas
Date: Mon Apr 14 23:01:41 2008
New Revision: 6499

Log:
	* flumotion/component/component.py:
	  In the refactoring, the code that handles errors from do_check
	  and stops going to setup got lost.  Put it back so that a
	  component doesn't actually go to setup if its do_check does not
	  want it to.



Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/component/component.py

Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Mon Apr 14 23:01:41 2008
@@ -1,3 +1,11 @@
+2008-04-14  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* flumotion/component/component.py:
+	  In the refactoring, the code that handles errors from do_check
+	  and stops going to setup got lost.  Put it back so that a
+	  component doesn't actually go to setup if its do_check does not
+	  want it to.
+
 2008-04-11  Johan Dahlin  <jdahlin at async.com.br>
 
 	* flumotion/wizard/overlaystep.py:

Modified: flumotion/trunk/flumotion/component/component.py
==============================================================================
--- flumotion/trunk/flumotion/component/component.py	(original)
+++ flumotion/trunk/flumotion/component/component.py	Mon Apr 14 23:01:41 2008
@@ -406,6 +406,18 @@
         # Call check methods, starting from the base class and working down to
         # subclasses.
         checks = common.get_all_methods(self, 'do_check', False)
+
+        def checkErrorCallback(result):
+            # if the mood is now sad, it means an error was encountered
+            # during check, and we should return a failure here.
+            # since the checks are responsible for adding a message,
+            # this is a handled error.
+            current = self.state.get('mood')
+            if current == moods.sad.value:
+                self.warning('Running checks made the component sad.')
+                raise errors.ComponentSetupHandledError()
+
+        checks.append(checkErrorCallback)
         return maybe_deferred_chain(checks, self)
 
     def do_stop(self):


More information about the flumotion-commit mailing list