summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Weiser <michael.weiser@gmx.de>2019-04-23 10:58:10 +0000
committerMichael Weiser <michael.weiser@gmx.de>2019-04-24 10:02:15 +0000
commitbc088b43eb3a2d1593b82163275ced656f85d4c4 (patch)
treed4206f45d7f72899d9a182e3b1841c9609f47ed1
parent7f7459adc192d1aa23b0ca34844af7769580d353 (diff)
db: Remove unnecessary else clause
Remove an unnecessary else clause for the non-error case to more clearly show standard execution flow.
-rw-r--r--peekaboo/db.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/peekaboo/db.py b/peekaboo/db.py
index 0cf11df..0c5cc45 100644
--- a/peekaboo/db.py
+++ b/peekaboo/db.py
@@ -421,22 +421,23 @@ class PeekabooDatabase(object):
def _db_schema_exists(self):
if not self.__engine.dialect.has_table(self.__engine, '_meta'):
return False
- else:
- session = self.__session()
- # get the first of potentially multiple metadata entries ordered by
- # descending schema version to get the newest currently configured
- # schema
- meta = session.query(PeekabooMetadata).order_by(
- PeekabooMetadata.db_schema_version.desc()).first()
- if not meta:
- return False
-
- schema_version = meta.db_schema_version
- session.close()
- if schema_version < DB_SCHEMA_VERSION:
- logger.info('Adding new database schema.')
- return False
- return True
+
+ session = self.__session()
+ # get the first of potentially multiple metadata entries ordered by
+ # descending schema version to get the newest currently configured
+ # schema
+ meta = session.query(PeekabooMetadata).order_by(
+ PeekabooMetadata.db_schema_version.desc()).first()
+ if not meta:
+ return False
+
+ schema_version = meta.db_schema_version
+ session.close()
+ if schema_version < DB_SCHEMA_VERSION:
+ logger.info('Adding new database schema.')
+ return False
+
+ return True
def _init_db(self):
"""