[extensions-web] review: Remove get_diff



commit d47b2cde6d07bb9496619a93056d18cbe83edfc5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jun 26 14:12:55 2012 -0400

    review: Remove get_diff
    
    The code is simple enough to move it in-view

 sweettooth/review/views.py |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 10e9bde..878a49c 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -120,17 +120,6 @@ def grab_lines(zipfile, filename):
         f.close()
         return content.splitlines()
 
-def get_diff(old_zipfile, new_zipfile, filename):
-    oldlines, newlines = grab_lines(old_zipfile, filename), grab_lines(new_zipfile, filename)
-
-    if oldlines == newlines:
-        return None
-
-    chunks = list(get_chunks(oldlines, newlines))
-    return dict(chunks=chunks,
-                oldlines=oldlines,
-                newlines=newlines)
-
 def get_file_list(zipfile):
     return set(n for n in zipfile.namelist() if not n.endswith('/'))
 
@@ -185,7 +174,16 @@ def ajax_get_file_diff_view(request, version):
         return None
 
     old_zipfile, new_zipfile = get_zipfiles(get_old_version(version), version)
-    return get_diff(old_zipfile, new_zipfile, filename)
+    oldlines, newlines = grab_lines(old_zipfile, filename), grab_lines(new_zipfile, filename)
+
+    if oldlines == newlines:
+        return None
+
+    chunks = list(get_chunks(oldlines, newlines))
+    return dict(chunks=chunks,
+                oldlines=oldlines,
+                newlines=newlines)
+
 
 @ajax_view
 @model_view(models.ExtensionVersion)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]