]> git.ipfire.org Git - location/libloc.git/commitdiff
python: Add new open() interface to easily open a database
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 13 Sep 2022 12:06:24 +0000 (12:06 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 13 Sep 2022 12:06:24 +0000 (12:06 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/location/__init__.py

index 9b570c797c552ecf151e451de2b560980a4b27d3..f63573775f3c67729a85cf2df695897aef7d354f 100644 (file)
@@ -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)