Author: bugman Date: Fri Sep 26 12:41:06 2014 New Revision: 26056 URL: http://svn.gna.org/viewcvs/relax?rev=26056&view=rev Log: Updated the pipe_control.spectrometer.check_*_func() functions to use the new design. Modified: trunk/pipe_control/spectrometer.py Modified: trunk/pipe_control/spectrometer.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/spectrometer.py?rev=26056&r1=26055&r2=26056&view=diff ============================================================================== --- trunk/pipe_control/spectrometer.py (original) +++ trunk/pipe_control/spectrometer.py Fri Sep 26 12:41:06 2014 @@ -39,19 +39,13 @@ @keyword id: The experiment ID string. @type id: str - @return: The status of the check and the message to send to the user. - @rtype: bool, str - """ - - # Init. - check_ok = True - + @return: The initialised RelaxError object or nothing. + @rtype: None or RelaxError instance + """ + # Check for the ID. if not hasattr(cdp, 'spectrometer_frq') and id not in cdp.spectrometer_frq.keys(): - check_ok = False - - # Return the status and message. - return check_ok, "No spectrometer frequency information is present for the experiment ID %s." % id + return RelaxNoFrqError(id=id) # Create the checking object. check_frequency = Check(check_frequency_func) @@ -60,23 +54,17 @@ def check_spectrometer_setup_func(self): """Check that spectrometer frequencies have been set up. - @return: The status of the check and the message to send to the user. - @rtype: bool, str - """ - - # Init. - check_ok = True - + @return: The initialised RelaxError object or nothing. + @rtype: None or RelaxError instance + """ + # No data structure. if not hasattr(cdp, 'spectrometer_frq'): - check_ok = False + return RelaxNoFrqError() # An empty list. - elif not len(cdp.spectrometer_frq): - check_ok = False - - # Return the status and message. - return check_ok, "No spectrometer frequency information is present." + if not len(cdp.spectrometer_frq): + return RelaxNoFrqError() # Create the checking object. check_spectrometer_setup = Check(check_spectrometer_setup_func)