diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100755 new mode 100644 index cf3aa47..3efe4e4 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/linkbacks.py b/linkbacks.py index ec8da35..f9ff4b5 100644 --- a/linkbacks.py +++ b/linkbacks.py @@ -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 @@ -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) diff --git a/pyproject.toml b/pyproject.toml index f3d9880..feadab8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", ]