From: Michael Tremer Date: Tue, 13 Sep 2022 12:06:24 +0000 (+0000) Subject: python: Add new open() interface to easily open a database X-Git-Tag: 0.9.15~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=affa49242b5c3eb766872b480b1235f4d08fb02e;p=location%2Flibloc.git python: Add new open() interface to easily open a database Signed-off-by: Michael Tremer --- diff --git a/src/python/location/__init__.py b/src/python/location/__init__.py index 9b570c7..f635737 100644 --- a/src/python/location/__init__.py +++ b/src/python/location/__init__.py @@ -22,3 +22,13 @@ from _location import * # Initialise logging from . import logger + +def open(path=None): + """ + Opens the database at path, or opens the default database. + """ + if not path: + path = DATABASE_PATH + + # Open the database + return Database(path)