]> git.ipfire.org Git - ddns.git/commitdiff
database: Open database for the search operations, too
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Apr 2015 18:15:33 +0000 (20:15 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Apr 2015 18:15:33 +0000 (20:15 +0200)
src/ddns/database.py

index 42c343391a9de1b7471291d933b96080c8837cf0..70a73635740211e356e2f68144dc4475f3390dea 100644 (file)
@@ -122,6 +122,9 @@ class DDNSDatabase(object):
                """
                        Returns the timestamp of the last update (with the given status code).
                """
+               if self._db is None:
+                       self._db = self._open_database(self.path)
+
                c = self._db.cursor()
 
                try:
@@ -141,6 +144,9 @@ class DDNSDatabase(object):
                """
                        Returns the update status of the last update.
                """
+               if self._db is None:
+                       self._db = self._open_database(self.path)
+
                c = self._db.cursor()
 
                try:
@@ -156,6 +162,9 @@ class DDNSDatabase(object):
                """
                        Returns the reason string for the last failed update (if any).
                """
+               if self._db is None:
+                       self._db = self._open_database(self.path)
+
                c = self._db.cursor()
 
                try: