mailr10407 - /branches/bieri_gui/data/__init__.py


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

Header


Content

Posted by edward on January 26, 2010 - 19:00:
Author: bugman
Date: Tue Jan 26 19:00:45 2010
New Revision: 10407

URL: http://svn.gna.org/viewcvs/relax?rev=10407&view=rev
Log:
Any objects with to_xml() methods in the base of the relax data store have 
this method called.


Modified:
    branches/bieri_gui/data/__init__.py

Modified: branches/bieri_gui/data/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/data/__init__.py?rev=10407&r1=10406&r2=10407&view=diff
==============================================================================
--- branches/bieri_gui/data/__init__.py (original)
+++ branches/bieri_gui/data/__init__.py Tue Jan 26 19:00:45 2010
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2004, 2006-2009 Edward d'Auvergne                       
 #
+# Copyright (C) 2003-2004, 2006-2010 Edward d'Auvergne                       
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -328,8 +328,24 @@
         top_element.setAttribute('version', version)
         top_element.setAttribute('time', asctime())
 
-        # Add all simple objects in the data store base object to the XML 
element.
-        fill_object_contents(xmldoc, top_element, object=self, 
blacklist=['relax_gui'] + list(self.__class__.__dict__.keys() + 
dict.__dict__.keys()))
+        # Add all objects in the data store base object to the XML element.
+        blacklist = list(self.__class__.__dict__.keys() + 
dict.__dict__.keys())
+        for name in dir(self):
+            # Skip blacklisted objects.
+            if name in blacklist:
+                continue
+
+            # Skip special objects.
+            if search('^_', name):
+                continue
+
+            # Execute any to_xml() methods, and add that object to the 
blacklist.
+            obj = getattr(self, name)
+            if hasattr(obj, 'to_xml'):
+                obj.to_xml(xmldoc, top_element)
+                blacklist = blacklist + [name]
+
+        fill_object_contents(xmldoc, top_element, object=self, 
blacklist=blacklist)
 
         # Loop over the pipes.
         for pipe in pipes:




Related Messages


Powered by MHonArc, Updated Tue Jan 26 19:20:02 2010