mailRe: r2533 - in /1.2: errors.py prompt/interpreter.py relax


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

Header


Content

Posted by Edward d'Auvergne on August 10, 2006 - 12:52:
Thanks.  I have a suggestion to simplify the state saving code and
that is that the save_state function is called within the BaseError
class.  This means that save_state is only called from one place in
the code by placing it within the __str__ function (which is called to
get the error message).  For example something like:

   class BaseError(Exception):
       def __str__(self):
           # Save the program state.
           if Debug:
               self.save_state()

           # The RelaxError message.
           return ("RelaxError: " + self.text + "\n")

       def save_state(self):
           """Function for saving the program state"""

           now = time.localtime()
           file_name = "relax_state_%i%i%i_%i%i%i" % (now[3], now[4], now[5],
                                                 now[2], now[1], now[0])
           self._relax.interpreter._State.save(file_name)

I would place the import statement at the top of the 'error.py' file
with the other import statements (and the save_state function probably
doesn't need the underscore out the front of it's name).  Do you think
it's worth having a separate command line flag for saving the state?
I don't think so but it would result in finer control.

Edward


On 8/10/06, c.a.macraild@xxxxxxxxxxx <c.a.macraild@xxxxxxxxxxx> wrote:
Author: macraild
Date: Thu Aug 10 12:26:14 2006
New Revision: 2533

URL: http://svn.gna.org/viewcvs/relax?rev=2533&view=rev
Log:
Alterations to the debug mode.

These changes reflect the discussion on relax-devel at gna dot org:
https://mail.gna.org/public/relax-devel/2006-08/msg00049.html

Two functions are implimented when in debuging mode:
1) KeyboardInterupt during script execution will print the normal
python traceback
2) The all of the relax exception classes will save the program
state

Modified:
    1.2/errors.py
    1.2/prompt/interpreter.py
    1.2/relax

[This mail would be too long, it was shortened to contain the URLs only.]

Modified: 1.2/errors.py
URL: 
http://svn.gna.org/viewcvs/relax/1.2/errors.py?rev=2533&r1=2532&r2=2533&view=diff

Modified: 1.2/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/1.2/prompt/interpreter.py?rev=2533&r1=2532&r2=2533&view=diff

Modified: 1.2/relax
URL: 
http://svn.gna.org/viewcvs/relax/1.2/relax?rev=2533&r1=2532&r2=2533&view=diff


_______________________________________________ relax (http://nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits




Related Messages


Powered by MHonArc, Updated Fri Aug 11 16:00:34 2006