From 1f5f16d5b8faa7b8cb2402319b6aa427986a42eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Lebrun?= Date: Wed, 25 Dec 2024 03:50:16 +0100 Subject: [PATCH] data: support calling get() on a non-existent key, by returning None MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- elixir/data.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/elixir/data.py b/elixir/data.py index 5c939be..4dc354f 100755 --- a/elixir/data.py +++ b/elixir/data.py @@ -165,8 +165,7 @@ class BsdDB: def get(self, key): key = autoBytes(key) p = self.db.get(key) - p = self.ctype(p) - return p + return self.ctype(p) if p is not None else None def get_keys(self): return self.db.keys()