conduit r1493 - in trunk: . conduit



Author: jstowers
Date: Tue Jun  3 21:09:59 2008
New Revision: 1493
URL: http://svn.gnome.org/viewvc/conduit?rev=1493&view=rev

Log:
2008-06-04  John Stowers  <john stowers gmail com>

	* conduit/SyncSet.py: Dont store the application version in the
	settings.xml file. Store a settings-version variable instead.
	Fixes #536400.



Modified:
   trunk/ChangeLog
   trunk/conduit/SyncSet.py

Modified: trunk/conduit/SyncSet.py
==============================================================================
--- trunk/conduit/SyncSet.py	(original)
+++ trunk/conduit/SyncSet.py	Tue Jun  3 21:09:59 2008
@@ -15,6 +15,10 @@
 import conduit.Conduit as Conduit
 import conduit.Settings as Settings
 
+#Increment this number when the xml settings file
+#changes format
+SETTINGS_VERSION = "1"
+
 class SyncSet(gobject.GObject):
     """
     Represents a group of conduits
@@ -123,7 +127,8 @@
         #Build the application settings xml document
         doc = xml.dom.minidom.Document()
         rootxml = doc.createElement("conduit-application")
-        rootxml.setAttribute("version", conduit.VERSION)
+        rootxml.setAttribute("application-version", conduit.VERSION)
+        rootxml.setAttribute("settings-version", SETTINGS_VERSION)
         doc.appendChild(rootxml)
         
         #Store the conduits
@@ -187,12 +192,13 @@
         try:
             #Open                
             doc = xml.dom.minidom.parse(xmlSettingFilePath)
-            xmlVersion = doc.documentElement.getAttribute("version")
-            #And check it is the correct version        
-            if xmlVersion != conduit.VERSION:
-                log.info("%s xml file is incorrect version" % xmlSettingFilePath)
-                os.remove(xmlSettingFilePath)
-                return
+            
+            #check the xml file is in a version we can read.
+            if doc.documentElement.hasAttribute("settings-version"):
+                if SETTINGS_VERSION != doc.documentElement.getAttribute("settings-version"):
+                    log.info("%s xml file is incorrect version" % xmlSettingFilePath)
+                    os.remove(xmlSettingFilePath)
+                    return
             
             #Parse...    
             for conds in doc.getElementsByTagName("conduit"):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]