some corrections in sqlite3 storage
[tiramisu.git] / tiramisu / storage / sqlite3 / setting.py
index 0c61c08..f91f9fd 100644 (file)
@@ -35,6 +35,7 @@ class Settings(Cache):
 
     # propertives
     def setproperties(self, path, properties):
+        path = self._sqlite_encode_path(path)
         self.storage.execute("DELETE FROM property WHERE path = ?", (path,),
                              False)
         self.storage.execute("INSERT INTO property(path, properties) VALUES "
@@ -42,6 +43,7 @@ class Settings(Cache):
                                         self._sqlite_encode(properties)))
 
     def getproperties(self, path, default_properties):
+        path = self._sqlite_encode_path(path)
         value = self.storage.select("SELECT properties FROM property WHERE "
                                     "path = ?", (path,))
         if value is None:
@@ -50,6 +52,7 @@ class Settings(Cache):
             return set(self._sqlite_decode(value[0]))
 
     def hasproperties(self, path):
+        path = self._sqlite_encode_path(path)
         return self.storage.select("SELECT properties FROM property WHERE "
                                    "path = ?", (path,)) is not None
 
@@ -57,6 +60,7 @@ class Settings(Cache):
         self.storage.execute("DELETE FROM property")
 
     def reset_properties(self, path):
+        path = self._sqlite_encode_path(path)
         self.storage.execute("DELETE FROM property WHERE path = ?", (path,))
 
     def get_properties(self, context):
@@ -65,17 +69,14 @@ class Settings(Cache):
         ret = {}
         for path, properties in self.storage.select("SELECT * FROM property",
                                                     only_one=False):
-            if path == '_none':
-                opt = None
-            else:
-                opt = context.cfgimpl_get_description().impl_get_opt_by_path(
-                    path)
+            path = self._sqlite_decode_path(path)
             properties = self._sqlite_decode(properties)
-            ret[opt] = properties
+            ret[path] = properties
         return ret
 
     # permissive
     def setpermissive(self, path, permissive):
+        path = self._sqlite_encode_path(path)
         self.storage.execute("DELETE FROM permissive WHERE path = ?", (path,),
                              False)
         self.storage.execute("INSERT INTO permissive(path, permissives) "