diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-14 10:18:57 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-14 10:18:57 +0000 |
commit | 5879b93d587f602920623c1b9abaa392ba9b52f6 (patch) | |
tree | 69552f74b49d8744fa8e743c08ab0063cfdb1bec /cfgv.py | |
parent | Releasing debian version 3.3.1-3. (diff) | |
download | cfgv-5879b93d587f602920623c1b9abaa392ba9b52f6.tar.xz cfgv-5879b93d587f602920623c1b9abaa392ba9b52f6.zip |
Merging upstream version 3.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cfgv.py')
-rw-r--r-- | cfgv.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,3 +1,5 @@ +from __future__ import annotations + import collections import contextlib import os.path @@ -390,12 +392,15 @@ def load_from_filename( schema, load_strategy, exc_tp=ValidationError, + *, + display_filename=None, ): + display_filename = display_filename or filename with reraise_as(exc_tp): if not os.path.isfile(filename): - raise ValidationError(f'{filename} is not a file') + raise ValidationError(f'{display_filename} is not a file') - with validate_context(f'File {filename}'): + with validate_context(f'File {display_filename}'): try: with open(filename, encoding='utf-8') as f: contents = f.read() |