Allow dataclasses in settings

This commit is contained in:
FriedrichFroebel 2023-10-11 19:29:17 +02:00 committed by GitHub
commit ab9e55b398
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ import locale
import logging import logging
import os import os
import re import re
import sys
from os.path import isabs from os.path import isabs
from pelican.log import LimitFilter from pelican.log import LimitFilter
@ -13,6 +14,7 @@ from pelican.log import LimitFilter
def load_source(name, path): def load_source(name, path):
spec = importlib.util.spec_from_file_location(name, path) spec = importlib.util.spec_from_file_location(name, path)
mod = importlib.util.module_from_spec(spec) mod = importlib.util.module_from_spec(spec)
sys.modules[name] = mod
spec.loader.exec_module(mod) spec.loader.exec_module(mod)
return mod return mod