From 1eb5a6f4651141f22679f8c9bad98a970814dba3 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 24 Nov 2018 22:06:16 -0800 Subject: [PATCH] Rename DatabaseOutOfDate's parameter 'current' -> 'existing'. --- etiquette/exceptions.py | 2 +- etiquette/photodb.py | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/etiquette/exceptions.py b/etiquette/exceptions.py index 88d13e8..22d7202 100644 --- a/etiquette/exceptions.py +++ b/etiquette/exceptions.py @@ -165,7 +165,7 @@ class BadDataDirectory(EtiquetteException): error_message = 'Bad data directory "{}"' OUTOFDATE = ''' -Database is out of date. {current} should be {new}. +Database is out of date. {existing} should be {new}. Please use utilities\\database_upgrader\\database_upgrader.py '''.strip() class DatabaseOutOfDate(EtiquetteException): diff --git a/etiquette/photodb.py b/etiquette/photodb.py index 8318ef7..4a789ce 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -1333,13 +1333,9 @@ class PhotoDB( Compare database's user_version against constants.DATABASE_VERSION, raising exceptions.DatabaseOutOfDate if not correct. ''' - existing_version = self.sql_execute('PRAGMA user_version').fetchone()[0] - if existing_version != constants.DATABASE_VERSION: - exc = exceptions.DatabaseOutOfDate( - current=existing_version, - new=constants.DATABASE_VERSION, - ) - raise exc + existing = self.sql_execute('PRAGMA user_version').fetchone()[0] + if existing != constants.DATABASE_VERSION: + raise exceptions.DatabaseOutOfDate(existing=existing, new=constants.DATABASE_VERSION) def _first_time_setup(self): self.log.debug('Running first-time setup.')