direct-io.hg

changeset 6821:960d4f6b58b3

Support removing nodes from store if value to store is None.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Wed Sep 14 19:29:25 2005 +0000 (2005-09-14)
parents f92bdd9153f5
children bc5dbfe729e0
files tools/python/xen/xend/xenstore/xstransact.py
line diff
     1.1 --- a/tools/python/xen/xend/xenstore/xstransact.py	Wed Sep 14 19:22:31 2005 +0000
     1.2 +++ b/tools/python/xen/xend/xenstore/xstransact.py	Wed Sep 14 19:29:25 2005 +0000
     1.3 @@ -113,7 +113,7 @@ class xstransact:
     1.4              else:
     1.5                  (key, fn, defval) = tup
     1.6              try:
     1.7 -                val = fn(self.read(key))
     1.8 +                val = fn(self._read(key))
     1.9              except TypeError:
    1.10                  val = defval
    1.11              ret.append(val)
    1.12 @@ -128,12 +128,16 @@ class xstransact:
    1.13                  try:
    1.14                      fmt = { str : "%s",
    1.15                              int : "%i",
    1.16 -                            float : "%f" }[type(val)]
    1.17 +                            float : "%f",
    1.18 +                            type(None) : None }[type(val)]
    1.19                  except KeyError:
    1.20                      raise TypeError
    1.21              else:
    1.22                  (key, val, fmt) = tup
    1.23 -            self.write(key, fmt % val)
    1.24 +            if val:
    1.25 +                self._write(key, fmt % val)
    1.26 +            else:
    1.27 +                self._remove(key)
    1.28  
    1.29  
    1.30      def Read(cls, path, *args):