diff --git a/src/app/app.py b/src/app/app.py index c8cdee4..9dcecab 100644 --- a/src/app/app.py +++ b/src/app/app.py @@ -177,7 +177,8 @@ class WebDbApplication(BaseApplication): async def get(self, key, default=None): record = self.db["kv"].find_one(key=key) if record: - return json.loads(record.get("value", "null")) + result = record.get("value","null") + return result == "null" and default or json.loads(result) return default async def insert(self, table_name, data): @@ -189,12 +190,12 @@ class WebDbApplication(BaseApplication): async def upsert(self, table_name, data, keys): return self.db[table_name].upsert(data, keys or []) - async def find(self, table_name, filters): + async def find(self, table_name, filters=None): if not filters: filters = {} return [dict(record) for record in self.db[table_name].find(**filters)] - async def find_one(self, table_name, filters): + async def find_one(self, table_name, filters=None): if not filters: filters = {} try: