changeset 337:fa3835d34fc1

fixed bug when diff command was different than available options
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 06 Jul 2010 23:47:28 +0200
parents 871c0dd1301c
children 1eb2267a5469
files pylons_app/controllers/files.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/controllers/files.py	Tue Jul 06 23:43:13 2010 +0200
+++ b/pylons_app/controllers/files.py	Tue Jul 06 23:47:28 2010 +0200
@@ -140,7 +140,7 @@
         hg_model = HgModel()
         diff1 = request.GET.get('diff1')
         diff2 = request.GET.get('diff2')
-        c.action = action = request.GET.get('diff')
+        c.action = request.GET.get('diff')
         c.no_changes = diff1 == diff2
         c.f_path = f_path
         c.repo = hg_model.get_repo(c.repo_name)
@@ -168,18 +168,20 @@
         
         diff = differ.DiffProcessor(f_udiff)
                                 
-        if action == 'download':
+        if c.action == 'download':
             diff_name = '%s_vs_%s.diff' % (diff1, diff2)
             response.content_type = 'text/plain'
             response.content_disposition = 'attachment; filename=%s' \
                                                     % diff_name             
             return diff.raw_diff()
         
-        elif action == 'raw':
+        elif c.action == 'raw':
             c.cur_diff = '<pre class="raw">%s</pre>' % h.escape(diff.raw_diff())
-        elif action == 'diff':
+        elif c.action == 'diff':
             c.cur_diff = diff.as_html()
-
+        else:
+            #default option
+            c.cur_diff = diff.as_html()
         return render('files/file_diff.html')
     
     def _get_history(self, repo, node, f_path):