data: support calling get() on a non-existent key, by returning None

This behavior isn't used at the moment, but is much more sensible that
the past that was to give None to whatever content-type lambda we had
(eg DefList that would call split on the None).

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
This commit is contained in:
Théo Lebrun 2024-12-25 03:50:16 +01:00
parent 9cd1b140d2
commit 1f5f16d5b8

View file

@ -165,8 +165,7 @@ class BsdDB:
def get(self, key): def get(self, key):
key = autoBytes(key) key = autoBytes(key)
p = self.db.get(key) p = self.db.get(key)
p = self.ctype(p) return self.ctype(p) if p is not None else None
return p
def get_keys(self): def get_keys(self):
return self.db.keys() return self.db.keys()