[conduit/gsoc09_alexandre: 20/24] Improved verbosity in Gconf and XML syncset backends.



commit 47d6c375313dcdabddf12ef0e5892171b00b4613
Author: Alexandre Rosenfeld <airmind gmail com>
Date:   Sat Aug 1 02:23:18 2009 -0300

    Improved verbosity in Gconf and XML syncset backends.

 conduit/SyncSet.py      |    2 +-
 conduit/SyncSetGConf.py |   11 ++++++++++-
 conduit/SyncSetXML.py   |    3 ++-
 3 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/conduit/SyncSet.py b/conduit/SyncSet.py
index 4878bfb..1d93619 100644
--- a/conduit/SyncSet.py
+++ b/conduit/SyncSet.py
@@ -139,7 +139,7 @@ class SyncSet(gobject.GObject):
     def save(self, xmlSettingFilePath=None):
         if xmlSettingFilePath == None:
             xmlSettingFilePath = self.xmlSettingFilePath
-        log.info("Saving Sync Set to %s" % self.xmlSettingFilePath)
+        
         #from SyncSetXML import SyncSetXML
         #SyncSetXML().save_to_xml(self, xmlSettingFilePath)
         from SyncSetGConf import SyncSetGConf
diff --git a/conduit/SyncSetGConf.py b/conduit/SyncSetGConf.py
index 2aea805..b2b864f 100644
--- a/conduit/SyncSetGConf.py
+++ b/conduit/SyncSetGConf.py
@@ -23,7 +23,8 @@ class SyncSetGConf(object):
         if value is None:
             return None
         if value.type == gconf.VALUE_PAIR:
-            log.critical(value.to_string)
+            log.critical("Dont know how to handle pairs: %s" % value.to_string())
+            return None
         return {gconf.VALUE_BOOL: value.get_bool, 
          gconf.VALUE_FLOAT: value.get_float, 
          gconf.VALUE_INT: value.get_int, 
@@ -43,8 +44,14 @@ class SyncSetGConf(object):
         elif vtype in (list, tuple):
             #FIXME We should support more then string lists
             client.set_list(path, gconf.VALUE_STRING, [str(i) for i in value])
+        else:
+            log.error("We cant handle %s yet" % (repr(vtype)))
 
+    #FIXME: Modularize each component, making it possible to only alter parts
+    #       of a syncset.
     def restore(self, syncset):
+        log.info("Restoring SyncSet from GConf: %s" % (SYNCSET_PATH + "/" + syncset.name))
+    
         for path in client.all_dirs(SYNCSET_PATH + "/" + syncset.name):
             cond_name = path.split("/")[-1]
             cond_path = path + "/"
@@ -94,6 +101,8 @@ class SyncSetGConf(object):
                 raise
 
     def save(self, syncset):
+        log.info("Saving SyncSet to GConf: %s" % (SYNCSET_PATH + "/" + syncset.name))
+    
         syncset_path = SYNCSET_PATH + "/" + syncset.name + "/"
         
         client.recursive_unset(SYNCSET_PATH + "/" + syncset.name, 0)
diff --git a/conduit/SyncSetXML.py b/conduit/SyncSetXML.py
index a7afdc4..1cc35ad 100644
--- a/conduit/SyncSetXML.py
+++ b/conduit/SyncSetXML.py
@@ -19,7 +19,7 @@ class SyncSetXML(object):
         they are connected) to an xml file so that the 'sync set' can
         be restored later
         """
-
+        log.info("Saving XML Sync Set to %s" % xmlSettingFilePath)
         #Build the application settings xml document
         doc = xml.dom.minidom.Document()
         rootxml = doc.createElement("conduit-application")
@@ -77,6 +77,7 @@ class SyncSetXML(object):
         Restores sync settings from the xml file
         """
 
+        log.info("Restoring XML Sync Set from %s" % xmlSettingFilePath)
            
         #Check the file exists
         if not os.path.isfile(xmlSettingFilePath):



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