From 19ccbd3b1760570b6485d955e65a80f97a706b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 11 Jan 2014 08:50:52 +0100 Subject: [PATCH] Fixed error in main script when using other database engine. Fixed #1166. --- CHANGELOG | 1 + openslides/__main__.py | 13 +++++++------ openslides/utils/main.py | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index cf34411b8..33acad76f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,7 @@ Files: Other: - Fixed http status code when requesting a non-existing static page using Tordado web server. +- Fixed error in main script when using other database engine. Version 1.5 (2013-11-25) diff --git a/openslides/__main__.py b/openslides/__main__.py index 405764e6f..ad3daef33 100644 --- a/openslides/__main__.py +++ b/openslides/__main__.py @@ -243,12 +243,13 @@ def syncdb(settings, args): ensure_settings(settings, args) # TODO: Check use of filesystem2unicode here. db_file = get_database_path_from_settings() - db_dir = filesystem2unicode(os.path.dirname(db_file)) - if not os.path.exists(db_dir): - os.makedirs(db_dir) - if not os.path.exists(db_file): - print('Clearing old search index...') - execute_from_command_line(["", "clear_index", "--noinput"]) + if db_file is not None: + db_dir = filesystem2unicode(os.path.dirname(db_file)) + if not os.path.exists(db_dir): + os.makedirs(db_dir) + if not os.path.exists(db_file): + print('Clearing old search index...') + execute_from_command_line(["", "clear_index", "--noinput"]) execute_from_command_line(["", "syncdb", "--noinput"]) return 0 diff --git a/openslides/utils/main.py b/openslides/utils/main.py index 210347a44..a4f553208 100644 --- a/openslides/utils/main.py +++ b/openslides/utils/main.py @@ -360,7 +360,7 @@ def get_database_path_from_settings(): raise DatabaseInSettingsError("Default databases is not configured") database_path = default.get('NAME') if not database_path: - raise DatabaseInSettingsError('No path specified for default database.') + raise DatabaseInSettingsError('No path or name specified for default database.') if default.get('ENGINE') != 'django.db.backends.sqlite3': database_path = None return database_path