Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Modernize the CSRF migration helper.

Thanks Lennart Regebro for spotting that code.
  • Loading branch information...
commit c6964feb54a15e87de5e0390d07fe5fff69729c7 1 parent 9c487b5
Aymeric Augustin authored May 17, 2013

Showing 1 changed file with 4 additions and 6 deletions. Show diff stats Hide diff stats

  1. 10  extras/csrf_migration_helper.py
10  extras/csrf_migration_helper.py
@@ -143,7 +143,7 @@ def get_template_dirs():
143 143
     """
144 144
     from django.conf import settings
145 145
     dirs = set()
146  
-    if ('django.template.loaders.filesystem.load_template_source' in settings.TEMPLATE_LOADERS 
  146
+    if ('django.template.loaders.filesystem.load_template_source' in settings.TEMPLATE_LOADERS
147 147
         or  'django.template.loaders.filesystem.Loader' in settings.TEMPLATE_LOADERS):
148 148
         dirs.update(map(unicode, settings.TEMPLATE_DIRS))
149 149
 
@@ -281,12 +281,10 @@ def search_python_list(python_code, template_names):
281 281
     Returns a list of tuples, each one being:
282 282
      (filename, line number)
283 283
     """
284  
-    retval = []
  284
+    retval = set()
285 285
     for tn in template_names:
286  
-        retval.extend(search_python(python_code, tn))
287  
-    retval = list(set(retval))
288  
-    retval.sort()
289  
-    return retval
  286
+        retval.update(search_python(python_code, tn))
  287
+    return sorted(retval)
290 288
 
291 289
 def search_python(python_code, template_name):
292 290
     """

0 notes on commit c6964fe

Please sign in to comment.
Something went wrong with that request. Please try again.