mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 05:26:37 +00:00
Check for the database vendor first
This commit is contained in:
parent
1f0169ae4b
commit
6a80758c9b
@ -90,9 +90,10 @@ class DashboardView(TemplateView):
|
|||||||
data['database_connection'] = settings.DATABASE_CONNECTION_STR
|
data['database_connection'] = settings.DATABASE_CONNECTION_STR
|
||||||
# Add the database filesize when using db.sqlite3
|
# Add the database filesize when using db.sqlite3
|
||||||
data['database_filesize'] = None
|
data['database_filesize'] = None
|
||||||
db_name = str(connection.get_connection_params()['database'])
|
if 'sqlite' == connection.vendor:
|
||||||
|
db_name = str(connection.get_connection_params().get('database', ''))
|
||||||
db_path = pathlib.Path(db_name) if '/' == db_name[0] else None
|
db_path = pathlib.Path(db_name) if '/' == db_name[0] else None
|
||||||
if db_path and 'sqlite' == connection.vendor:
|
if db_path:
|
||||||
data['database_filesize'] = db_path.stat().st_size
|
data['database_filesize'] = db_path.stat().st_size
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user