From 40dc1e79d1c75d0007fe74becf75a1dc3e84d6b9 Mon Sep 17 00:00:00 2001 From: Jordan Cook Date: Wed, 21 Apr 2021 21:12:46 -0500 Subject: For SQLite and filesystem backends, resolve file paths in BaseStorage class rather than BaseCache class --- requests_cache/backends/sqlite.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'requests_cache/backends/sqlite.py') diff --git a/requests_cache/backends/sqlite.py b/requests_cache/backends/sqlite.py index 470d00c..face65e 100644 --- a/requests_cache/backends/sqlite.py +++ b/requests_cache/backends/sqlite.py @@ -25,7 +25,6 @@ class DbCache(BaseCache): def __init__(self, db_path: Union[Path, str] = 'http_cache', fast_save: bool = False, **kwargs): super().__init__(**kwargs) - db_path = _get_db_path(db_path) self.responses = DbPickleDict(db_path, table_name='responses', fast_save=fast_save, **kwargs) self.redirects = DbDict(db_path, table_name='redirects', **kwargs) @@ -60,7 +59,7 @@ class DbDict(BaseStorage): kwargs.setdefault('suppress_warnings', True) super().__init__(**kwargs) self.connection_kwargs = get_valid_kwargs(sqlite_template, kwargs) - self.db_path = db_path + self.db_path = _get_db_path(db_path) self.fast_save = fast_save self.table_name = table_name -- cgit v1.2.1 From dc204a8d7df9c627fcfb2b098a28f2f27fbb31c8 Mon Sep 17 00:00:00 2001 From: Jordan Cook Date: Thu, 22 Apr 2021 00:21:33 -0500 Subject: Move storage class __str__ methods to base class, and just show keys instead of items --- requests_cache/backends/sqlite.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'requests_cache/backends/sqlite.py') diff --git a/requests_cache/backends/sqlite.py b/requests_cache/backends/sqlite.py index face65e..9c98fcd 100644 --- a/requests_cache/backends/sqlite.py +++ b/requests_cache/backends/sqlite.py @@ -143,9 +143,6 @@ class DbDict(BaseStorage): with self.connection(True) as con: con.execute("vacuum") - def __str__(self): - return str(dict(self.items())) - class DbPickleDict(DbDict): """Same as :class:`DbDict`, but pickles values before saving""" -- cgit v1.2.1