Author: bugman Date: Wed Dec 15 01:35:28 2010 New Revision: 11827 URL: http://svn.gna.org/viewcvs/relax?rev=11827&view=rev Log: Fixes for the status object by renaming __init__() to setup() and calling it only once. The object was not acting as a singleton because of the presence of __init__(). This is now fixed. Modified: 1.3/status.py Modified: 1.3/status.py URL: http://svn.gna.org/viewcvs/relax/1.3/status.py?rev=11827&r1=11826&r2=11827&view=diff ============================================================================== --- 1.3/status.py (original) +++ 1.3/status.py Wed Dec 15 01:35:28 2010 @@ -36,7 +36,19 @@ # Class variable for storing the class instance (for the singleton). _instance = None - def __init__(self): + def __new__(self, *args, **kargs): + """Replacement method for implementing the singleton design pattern.""" + + # First instantiation. + if self._instance is None: + # Instantiate. + self._instance = object.__new__(self, *args, **kargs) + + # Already instantiated, so return the instance. + return self._instance + + + def setup(self): """Initialise all the status data structures.""" # Execution lock object. @@ -53,18 +65,6 @@ self.dAuvergne_protocol.local_tm_models = None # The list of model-free local tm models for optimisation, i.e. the global iteration. self.dAuvergne_protocol.current_model = None # The current model-free model. self.dAuvergne_protocol.convergence = False # The convergence of the global model. - - - def __new__(self, *args, **kargs): - """Replacement method for implementing the singleton design pattern.""" - - # First instantiation. - if self._instance is None: - # Instantiate. - self._instance = object.__new__(self, *args, **kargs) - - # Already instantiated, so return the instance. - return self._instance