mailr7651 - /1.3/data/__init__.py


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

Header


Content

Posted by edward on October 12, 2008 - 17:05:
Author: bugman
Date: Sun Oct 12 17:05:21 2008
New Revision: 7651

URL: http://svn.gna.org/viewcvs/relax?rev=7651&view=rev
Log:
Fixes for the relax data store singleton 'add()', 'to_xml()', and 
'from_xml()' methods.

These were referring to the contents of the singleton as self, whereas in 
reality with the current
temporary implementation it is stored in self.instance.  Hence the singleton 
wasn't operating on
itself.


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=7651&r1=7650&r2=7651&view=diff
==============================================================================
--- 1.3/data/__init__.py (original)
+++ 1.3/data/__init__.py Sun Oct 12 17:05:21 2008
@@ -75,7 +75,7 @@
         # The data pipes.
         text = text + "\n"
         text = text + "Data pipes:\n"
-        pipes = self.keys()
+        pipes = self.instance.keys()
         if pipes:
             for pipe in pipes:
                 text = text + "  %s\n" % `pipe`
@@ -132,7 +132,7 @@
             del self.__dict__[key]
 
         # Remove all items from the dictionary.
-        self.clear()
+        self.instance.clear()
 
 
     def add(self, pipe_name, pipe_type):
@@ -147,7 +147,7 @@
         """
 
         # Test if the pipe already exists.
-        if pipe_name in self.keys():
+        if pipe_name in self.instance.keys():
             raise RelaxPipeError, pipe_name
 
         # Create a new container.
@@ -157,7 +157,7 @@
         self[pipe_name].pipe_type = pipe_type
 
         # Change the current data pipe.
-        self.current_pipe = pipe_name
+        self.instance.current_pipe = pipe_name
 
 
     def from_xml(self, file, dir=None, verbosity=1):
@@ -182,7 +182,7 @@
         relax_version = str(relax_node.getAttribute('version'))
 
         # Fill the pipe.
-        self[self.current_pipe].from_xml(relax_node, dir=dir)
+        self[self.instance.current_pipe].from_xml(relax_node, dir=dir)
 
 
     def to_xml(self, file):
@@ -197,29 +197,29 @@
         """
 
         # Create the XML document object.
-        self.xmldoc = xml.dom.minidom.Document()
+        xmldoc = xml.dom.minidom.Document()
 
         # Create the top level element, including the relax URL.
-        top_element = self.xmldoc.createElementNS('http://nmr-relax.com', 
'relax')
+        top_element = xmldoc.createElementNS('http://nmr-relax.com', 'relax')
 
         # Append the element.
-        self.xmldoc.appendChild(top_element)
+        xmldoc.appendChild(top_element)
 
         # Set the relax version number, and add a creation time.
         top_element.setAttribute('version', version)
         top_element.setAttribute('time', asctime())
 
         # Create the pipe XML element and add it to the top level XML 
element.
-        pipe_element = self.xmldoc.createElement('pipe')
+        pipe_element = xmldoc.createElement('pipe')
         top_element.appendChild(pipe_element)
 
         # Set the data pipe attributes.
         pipe_element.setAttribute('desc', 'The contents of a relax data 
pipe')
-        pipe_element.setAttribute('name', self.current_pipe)
-        pipe_element.setAttribute('type', self[self.current_pipe].pipe_type)
+        pipe_element.setAttribute('name', self.instance.current_pipe)
+        pipe_element.setAttribute('type', 
self[self.instance.current_pipe].pipe_type)
 
         # Fill the data pipe XML element.
-        self[self.current_pipe].to_xml(self.xmldoc, pipe_element)
+        self[self.instance.current_pipe].to_xml(xmldoc, pipe_element)
 
         # Write out the XML file.
-        file.write(self.xmldoc.toprettyxml(indent='    '))
+        file.write(xmldoc.toprettyxml(indent='    '))




Related Messages


Powered by MHonArc, Updated Sun Oct 12 17:20:03 2008