Author: bugman Date: Tue Apr 15 16:20:44 2014 New Revision: 22767 URL: http://svn.gna.org/viewcvs/relax?rev=22767&view=rev Log: Converted the status.escalate variable into module variables for lib.errors and lib.warnings. This variable is set by the command line flag '-e' or '--escalate'. By converting it into a module variable, the lib.errors and lib.warnings warnings are now independent of relax. Modified: trunk/lib/errors.py trunk/lib/warnings.py trunk/relax.py trunk/status.py Modified: trunk/lib/errors.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/errors.py?rev=22767&r1=22766&r2=22767&view=diff ============================================================================== --- trunk/lib/errors.py (original) +++ trunk/lib/errors.py Tue Apr 15 16:20:44 2014 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003-2013 Edward d'Auvergne # +# Copyright (C) 2003-2014 Edward d'Auvergne # # Copyright (C) 2014 Troels E. Linnet # # # # This file is part of the program relax (http://www.nmr-relax.com). # @@ -38,6 +38,9 @@ from compat import pickle from lib import ansi + +# Module variables for changing the behaviour of the warning system. +ESCALATE = False # If True, warnings will be converted into errors. # Text variables. BIN = 'a binary number (0 or 1)' @@ -133,8 +136,7 @@ """Modify the behaviour of the error system.""" # Save the state if the escalate flag is turned on. - from status import Status; status = Status() - if status.escalate: + if ESCALATE: save_state() # Modify the error message to include 'RelaxError' at the start (using coloured text if a TTY). Modified: trunk/lib/warnings.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/warnings.py?rev=22767&r1=22766&r2=22767&view=diff ============================================================================== --- trunk/lib/warnings.py (original) +++ trunk/lib/warnings.py Tue Apr 15 16:20:44 2014 @@ -1,7 +1,7 @@ from __future__ import absolute_import ############################################################################### # # -# Copyright (C) 2003-2013 Edward d'Auvergne # +# Copyright (C) 2003-2014 Edward d'Auvergne # # Copyright (C) 2014 Troels E. Linnet # # # # This file is part of the program relax (http://www.nmr-relax.com). # @@ -30,7 +30,10 @@ # relax module imports. from lib import ansi -from status import Status; status = Status() + + +# Module variables for changing the behaviour of the warning system. +ESCALATE = False # If True, warnings will be converted into errors. # The warning formatting function. @@ -41,7 +44,7 @@ message = "RelaxWarning: %s\n" % message # Print stack-trace in escalate mode. - if status.escalate: + if ESCALATE: tb = "" for frame in inspect.stack()[4:]: file = frame[1] @@ -78,7 +81,7 @@ warnings.formatwarning = format # Set warning filters. - if status.escalate: + if ESCALATE: warnings.filterwarnings('error', category=BaseWarning) else: warnings.filterwarnings('always', category=BaseWarning) Modified: trunk/relax.py URL: http://svn.gna.org/viewcvs/relax/trunk/relax.py?rev=22767&r1=22766&r2=22767&view=diff ============================================================================== --- trunk/relax.py (original) +++ trunk/relax.py Tue Apr 15 16:20:44 2014 @@ -322,7 +322,8 @@ # escalate flag. if options.escalate: - status.escalate = True + lib.warnings.ESCALATE = True + lib.errors.ESCALATE = True # Script prompt interactive inspection flag. if options.prompt: Modified: trunk/status.py URL: http://svn.gna.org/viewcvs/relax/trunk/status.py?rev=22767&r1=22766&r2=22767&view=diff ============================================================================== --- trunk/status.py (original) +++ trunk/status.py Tue Apr 15 16:20:44 2014 @@ -52,7 +52,6 @@ # Initialise some variables. self._instance.debug = False - self._instance.escalate = False self._instance.prompt = False self._instance.test_mode = False self._instance.uf_intro = False