Author: bugman Date: Fri Sep 26 12:40:16 2014 New Revision: 26055 URL: http://svn.gna.org/viewcvs/relax?rev=26055&view=rev Log: Changed the design of the Check object in lib.checks. The design of the checking function to call has been modified - it should now return either None if the check passes or an instantiated RelaxError object if not. This is then used to determine if the __call__() method should return True (when None is received). Otherwise if escalate is set to 1, the text from the RelaxError object is sent into a RelaxWarning and False is returned. And if escalate is set to 2, then the error object is simply raised. Modified: trunk/lib/checks.py Modified: trunk/lib/checks.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/checks.py?rev=26055&r1=26054&r2=26055&view=diff ============================================================================== --- trunk/lib/checks.py (original) +++ trunk/lib/checks.py Fri Sep 26 12:40:16 2014 @@ -60,13 +60,17 @@ """ # Perform the check. - check_ok, msg = self.checks(*args, **kargs) + error = self.checks(*args, **kargs) - # Warnings and errors. - if not check_ok and escalate == 1: - warn(RelaxWarning(msg)) - elif not check_ok and escalate == 2: - raise RelaxError(msg) - - # Return the status. - return check_ok + # No errors. + if error == None: + return True + + # Send the text of the RelaxError object into the RelaxWarning system. + if escalate == 1: + warn(RelaxWarning(error.text)) + return False + + # The error system. + if escalate == 2: + raise error