Skip to content

Commit

Permalink
Fix dotted filenames support on Python3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
amol- committed Mar 14, 2024
1 parent 20d2c04 commit 49e968e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tg/util/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ def get_dotted_filename(self, template_name, template_extension='.html'):

with open(result, 'wb') as result_f:
result_f.write(f.read_bytes())
except (ModuleNotFoundError, FileNotFoundError) as e:
except FileNotFoundError as e:
# Historical behaviour has been to return file even when it doesn't exist
# it's up to the caller to verify that the file actually exists.
result = e.filename
except ModuleNotFoundError as e:
raise DottedFileLocatorError(
"%s. Perhaps you have forgotten an __init__.py in that folder." % e
)
Expand Down

0 comments on commit 49e968e

Please sign in to comment.