Skip to content

Commit

Permalink
fixup: make requested changes
Browse files Browse the repository at this point in the history
- Use `config.basename` instead of re-parsing config path
- Update docstring (final """)
  • Loading branch information
HumorBaby committed Aug 14, 2019
1 parent 701be15 commit 2885698
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sopel/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class SopelDB(object):
to the database, wherever the user has configured it to be.
When configured with a relative filename, it is assumed to be in the directory
set (or defaulted to) in the core setting 'homedir'."""
set (or defaulted to) in the core setting 'homedir'.
"""

def __init__(self, config):
# MySQL - mysql://username:password@localhost/db
Expand All @@ -99,10 +100,8 @@ def __init__(self, config):
# Handle SQLite explicitly as a default
if db_type == 'sqlite':
path = config.core.db_filename
_, config_file = os.path.split(config.filename)
config_name, _ = os.path.splitext(config_file)
if path is None:
path = os.path.join(config.core.homedir, config_name + '.db')
path = os.path.join(config.core.homedir, config.basename + '.db')
path = os.path.expanduser(path)
if not os.path.isabs(path):
path = os.path.normpath(os.path.join(config.core.homedir, path))
Expand Down

0 comments on commit 2885698

Please sign in to comment.