Skip to content

Commit

Permalink
If the cache/ directory does not exist, it is created - fix #11
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C committed Aug 1, 2023
1 parent ce98bfe commit a72a2f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.0.5] - not released yet
### Added
* ensured support for the latest Python 3.11 version
### Fixed
* `ImportError` with Python 3.6 due to `contextlib.nullcontext` not existing yet
* if the `cache/` directory does not exist, it is created - _cf._ [issue #11](https://github.com/pelican-plugins/linkbacks/issues/11)

## [1.0.4] - 2020-07-15
### Changed
Expand Down
7 changes: 6 additions & 1 deletion linkbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from contextlib import suppress as nullcontext
from datetime import datetime
import json, logging, os, xmlrpc.client, warnings
from os import makedirs
from os.path import splitext
from ssl import CERT_NONE, SSLError
from urllib.parse import urljoin
Expand Down Expand Up @@ -67,7 +68,11 @@ def __init__(self, settings=None):
if settings is None:
settings = {}
self.siteurl = settings.get('SITEURL', '')
self.cache_filepath = settings.get('LINKBACKS_CACHEPATH') or os.path.join(settings.get('CACHE_PATH', ''), CACHE_FILENAME)
self.cache_filepath = settings.get('LINKBACKS_CACHEPATH')
if not self.cache_filepath:
cache_dir = settings.get('CACHE_PATH', '')
self.cache_filepath = os.path.join(cache_dir, CACHE_FILENAME)
makedirs(cache_dir, exist_ok=True)
self.cert_verify = settings.get('LINKBACKS_CERT_VERIFY', DEFAULT_CERT_VERIFY)
self.timeout = settings.get('LINKBACKS_REQUEST_TIMEOUT', DEFAULT_TIMEOUT)
self.user_agent = settings.get('LINKBACKS_USERAGENT', DEFAULT_USER_AGENT)
Expand Down
7 changes: 0 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ classifiers = [
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Software Development :: Libraries :: Python Modules",
]
Expand Down

0 comments on commit a72a2f9

Please sign in to comment.