diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-05-17 18:15:08 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-05-17 18:15:08 +0200 |
| commit | c6964feb54a15e87de5e0390d07fe5fff69729c7 (patch) | |
| tree | f99f88d989838a82682d48436746ceb19cf84c12 /extras | |
| parent | 9c487b5974ee7e7f196079611d7352364e8873ed (diff) | |
Modernize the CSRF migration helper.
Thanks Lennart Regebro for spotting that code.
Diffstat (limited to 'extras')
| -rwxr-xr-x | extras/csrf_migration_helper.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/extras/csrf_migration_helper.py b/extras/csrf_migration_helper.py index 62a8fb92af..2a8853494c 100755 --- a/extras/csrf_migration_helper.py +++ b/extras/csrf_migration_helper.py @@ -143,7 +143,7 @@ def get_template_dirs(): """ from django.conf import settings dirs = set() - if ('django.template.loaders.filesystem.load_template_source' in settings.TEMPLATE_LOADERS + if ('django.template.loaders.filesystem.load_template_source' in settings.TEMPLATE_LOADERS or 'django.template.loaders.filesystem.Loader' in settings.TEMPLATE_LOADERS): dirs.update(map(unicode, settings.TEMPLATE_DIRS)) @@ -281,12 +281,10 @@ def search_python_list(python_code, template_names): Returns a list of tuples, each one being: (filename, line number) """ - retval = [] + retval = set() for tn in template_names: - retval.extend(search_python(python_code, tn)) - retval = list(set(retval)) - retval.sort() - return retval + retval.update(search_python(python_code, tn)) + return sorted(retval) def search_python(python_code, template_name): """ |
