Skip to content

Commit

Permalink
In the template directory grokker, ignore files without extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
janjaapdriessen committed May 5, 2016
1 parent fff91ee commit 397af13
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ src/*.egg-info
bin
develop-eggs
parts
*.swp
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changes
2.11 (unreleased)
-----------------

- Nothing changed yet.
- In the template directory grokker, ignore files without extensions.


2.10.2 (2016-02-02)
Expand Down
3 changes: 3 additions & 0 deletions src/grokcore/view/templatereg.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def _register_template_file(self, module_info, template_path):
"for pt files. Now the file '%s' in '%s' "
"cannot be rendered" %
(template_file, template_dir), UserWarning, 2)
elif extension == '':
"""Don't choke on subdirs or files without extensions."""
return
else:
warnings.warn("File '%s' has an unrecognized extension in "
"directory '%s'" %
Expand Down
5 changes: 5 additions & 0 deletions src/grokcore/view/tests/view/dirtemplatesonly.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
The same applies to files and directories ending with '~' or starting
with a dot ('.').
Subdirectories of the template directory are not warned about either::
>>> 'subdir' in lastwarning
False
Restore the warning machinery::
>>> warnings.warn = saved_warn
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# I am only here in order to add this dir to git.

0 comments on commit 397af13

Please sign in to comment.