-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Django 1.8-1.10 #12
base: master
Are you sure you want to change the base?
Conversation
…EBUG setting, so we need to extract the Origin's directory name.
…tached to the engine, as such, we must extract them from the appropriate place, falling back to the old setting as necessary. In 1.10, it looks like _accepts_engine_in_init is gone, and all loaders require the engine be passed down to their constructor.
…om importlib.util import find_spec as importlib_find" For build failure, see https://travis-ci.org/kezabelle/django-template-finder/jobs/175687136
Thank you @kezabelle - that's some great work! I shall find time this week to review your Pull Request. |
This would be great! Seems straight-forward and tests look good. |
Sorry it took so long. I have left some comments. Otherwise looks great. @kezabelle can you see if these make sense? |
templatefinder/tests.py
Outdated
try: | ||
from django.utils import unittest | ||
except ImportError: | ||
import unittest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just add a comment explaining when does the ImportError
happen and why we need to do it that way?
templatefinder/utils.py
Outdated
@@ -51,14 +55,24 @@ def find_all_templates(pattern='*.html'): | |||
): | |||
loader_class = getattr(import_module(module), klass) | |||
if getattr(loader_class, '_accepts_engine_in_init', False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could rewrite that part not to use if getattr(loader_class, '_accepts_engine_in_init', False)
- since we anyway need to handle the possible TypeError? Or is it better to keep it like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could also inspect the signature of the __init__
method on the loader_class
to establish whether it accepts an engine
or not?
What do you think?
…est stops being available.
…g an engine to the loader, we can avoid checking the transitory variable _accepts_engine_in_init
The worst thing about GitHub is being able to mark a notification as unread, so I entirely forgot about this. |
The changes as given represent the minimum necessary to get a travis build working (see here) & also working in my local copy.