mailr14009 - /1.3/relax_warnings.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 29, 2011 - 18:37:
Author: bugman
Date: Fri Jul 29 18:37:15 2011
New Revision: 14009

URL: http://svn.gna.org/viewcvs/relax?rev=14009&view=rev
Log:
RelaxWarnings now only show a traceback when the pedantic flag is True.


Modified:
    1.3/relax_warnings.py

Modified: 1.3/relax_warnings.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/relax_warnings.py?rev=14009&r1=14008&r2=14009&view=diff
==============================================================================
--- 1.3/relax_warnings.py (original)
+++ 1.3/relax_warnings.py Fri Jul 29 18:37:15 2011
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2010 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2011 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -23,13 +23,11 @@
 # Module docstring.
 """Module containing all of the RelaxWarning objects."""
 
-
 # Python module imports.
 import inspect
 import warnings
 
 # relax module imports.
-from relax_errors import BaseError
 from status import Status; status = Status()
 
 
@@ -38,11 +36,10 @@
     """ Replacement for warnings.formatwarning to customise output format."""
 
     # Add the text 'RelaxWarning: ' to the start of the warning message.
-    #if issubclass(category, BaseWarning):
     message = "RelaxWarning: %s\n" % message
 
-    # Print stack-trace in debug mode.
-    if status.debug:
+    # Print stack-trace in pedantic mode.
+    if status.pedantic:
         tb = ""
         for frame in inspect.stack()[4:]:
             file = frame[1]
@@ -63,14 +60,14 @@
     return message
 
 
-def setup(pedantic=False):
+def setup():
     """Set up the warning system."""
 
     # Format warning messages.
     warnings.formatwarning = format
 
     # Set warning filters.
-    if pedantic:
+    if status.pedantic:
         warnings.filterwarnings('error', category=BaseWarning)
     else:
         warnings.filterwarnings('always', category=BaseWarning)
@@ -80,7 +77,7 @@
 # Base class for all warnings.
 ##############################
 
-class BaseWarning(Warning, BaseError):
+class BaseWarning(Warning):
     def __str__(self):
         return self.text
 




Related Messages


Powered by MHonArc, Updated Fri Jul 29 18:40:02 2011