mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Support removing nodes from store if value to store is None.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
This commit is contained in:
1 parent
e995abd494
commit
413f5b924c
1 file changed
+7
-3
@@ -113,7 +113,7 @@ class xstransact:
|
||||
else:
|
||||
(key, fn, defval) = tup
|
||||
try:
|
||||
val = fn(self.read(key))
|
||||
val = fn(self._read(key))
|
||||
except TypeError:
|
||||
val = defval
|
||||
ret.append(val)
|
||||
@@ -128,12 +128,16 @@ class xstransact:
|
||||
try:
|
||||
fmt = { str : "%s",
|
||||
int : "%i",
|
||||
float : "%f" }[type(val)]
|
||||
float : "%f",
|
||||
type(None) : None }[type(val)]
|
||||
except KeyError:
|
||||
raise TypeError
|
||||
else:
|
||||
(key, val, fmt) = tup
|
||||
self.write(key, fmt % val)
|
||||
if val:
|
||||
self._write(key, fmt % val)
|
||||
else:
|
||||
self._remove(key)
|
||||
|
||||
|
||||
def Read(cls, path, *args):
|
||||
|
||||