Author: bugman Date: Thu Jul 14 18:38:10 2011 New Revision: 13631 URL: http://svn.gna.org/viewcvs/relax?rev=13631&view=rev Log: Bug fix for the relax save states - the current data pipe is now saved and restored. The info about the cdp was being blacklisted, so was not stored in the relax save file. Modified: 1.3/data/__init__.py Modified: 1.3/data/__init__.py URL: http://svn.gna.org/viewcvs/relax/1.3/data/__init__.py?rev=13631&r1=13630&r2=13631&view=diff ============================================================================== --- 1.3/data/__init__.py (original) +++ 1.3/data/__init__.py Thu Jul 14 18:38:10 2011 @@ -146,17 +146,17 @@ self.instance.clear() - def add(self, pipe_name, pipe_type): + def add(self, pipe_name, pipe_type, switch=True): """Method for adding a new data pipe container to the dictionary. - This method should be used rather than importing the PipeContainer class and using the - statement 'D[pipe] = PipeContainer()', where D is the relax data storage object and pipe is - the name of the data pipe. + This method should be used rather than importing the PipeContainer class and using the statement 'D[pipe] = PipeContainer()', where D is the relax data storage object and pipe is the name of the data pipe. @param pipe_name: The name of the new data pipe. @type pipe_name: str @param pipe_type: The data pipe type. @type pipe_type: str + @keyword switch: A flag which if True will cause the new data pipe to be set to the current data pipe. + @type switch: bool """ # Test if the pipe already exists. @@ -170,8 +170,9 @@ self[pipe_name].pipe_type = pipe_type # Change the current data pipe. - self.instance.current_pipe = pipe_name - __builtin__.cdp = self[pipe_name] + if switch: + self.instance.current_pipe = pipe_name + __builtin__.cdp = self[pipe_name] def is_empty(self): @@ -304,7 +305,7 @@ pipe_type = pipe_node.getAttribute('type') # Add the data pipe. - self.add(pipe_name, pipe_type) + self.add(pipe_name, pipe_type, switch=False) # Fill the pipe. self[pipe_name].from_xml(pipe_node, file_version=file_version, dir=dir) @@ -364,6 +365,9 @@ obj.to_xml(xmldoc, top_element) blacklist = blacklist + [name] + # Remove the current data pipe from the blacklist! + blacklist.remove('current_pipe') + # Add all simple python objects within the PipeContainer to the pipe element. if all: fill_object_contents(xmldoc, top_element, object=self, blacklist=blacklist)