Author: bugman Date: Sun Oct 28 18:55:32 2007 New Revision: 3379 URL: http://svn.gna.org/viewcvs/relax?rev=3379&view=rev Log: Fix for bug #9389 (https://gna.org/bugs/?9389). This bug was caused by the move away from using the __builtin__ namespace. As the file is now treated as a module from which errors must be imported, the AllRelaxErrors object was not being created. The solution was to add the function 'all_errors()' which returns a list of all the RelaxError objects. Modified: 1.3/relax_errors.py Modified: 1.3/relax_errors.py URL: http://svn.gna.org/viewcvs/relax/1.3/relax_errors.py?rev=3379&r1=3378&r2=3379&view=diff ============================================================================== --- 1.3/relax_errors.py (original) +++ 1.3/relax_errors.py Sun Oct 28 18:55:32 2007 @@ -683,17 +683,30 @@ # An object of all the RelaxErrors. ################################### -# Loop over all objects of this module. -for name in dir(): - # Get the object. - object = globals()[name] - - # Skip over all non error class objects. - if type(object) != ClassType or not match('Relax', name): - continue - - # Tuple of all the errors. - if 'AllRelaxErrors' in dir(): - AllRelaxErrors = AllRelaxErrors, object - else: - AllRelaxErrors = object, +# Function for setting up the AllRelaxErrors object. +def all_errors(names): + """Function for returning all the RelaxErrors to allow the AllRelaxError object to be created.""" + + # Empty list. + list = None + + # Loop over all objects of this module. + for name in names: + # Get the object. + object = globals()[name] + + # Skip over all non error class objects. + if not (isinstance(object, ClassType) or isinstance(object, type(type))) or not match('Relax', name): + continue + + # Tuple of all the errors. + if list == None: + list = object, + else: + list = list, object + + # Return the list of RelaxErrors + return list + +# Initialise the AllRelaxErrors structure so it can be imported. +AllRelaxErrors = all_errors(dir())