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:
cl349@firebug.cl.cam.ac.uk committed 2005-09-14 19:29:25 +00:00
1 parent e995abd494
commit 413f5b924c
1 file changed
+7 -3
+7 -3
View File
@@ -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):
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.