diff rhodecode/controllers/compare.py @ 3442:b3680a200f75 beta

compare: cleanup of as_form handling as_form is only used when loaded 'partial' from pullrequest.html. Including it in the 'Detailed compare view' url did thus not do any harm. as_form is never used in pullrequest_show.html or compare_diff.html and it is thus never used together with swap_url ... which is why the wrong 'as_form=None' or 'as_form=False' in urls didn't do any harm.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 28 Feb 2013 17:54:42 +0100
parents bd5420ea396b
children 3ac76dfdab8e
line wrap: on
line diff
--- a/rhodecode/controllers/compare.py	Thu Feb 28 23:21:46 2013 +0100
+++ b/rhodecode/controllers/compare.py	Thu Feb 28 17:54:42 2013 +0100
@@ -91,15 +91,17 @@
         c.fulldiff = fulldiff = request.GET.get('fulldiff')
         rev_start = request.GET.get('rev_start')
         rev_end = request.GET.get('rev_end')
-
-        c.swap_url = h.url('compare_url', as_form=request.GET.get('as_form'),
+        # partial uses compare_cs.html template directly
+        partial = request.environ.get('HTTP_X_PARTIAL_XHR')
+        # as_form puts hidden input field with changeset revisions
+        c.as_form = partial and request.GET.get('as_form')
+        # swap url for compare_diff page - never partial and never as_form
+        c.swap_url = h.url('compare_url',
             repo_name=other_repo,
             org_ref_type=other_ref[0], org_ref=other_ref[1],
             other_repo=org_repo,
             other_ref_type=org_ref[0], other_ref=org_ref[1])
 
-        partial = request.environ.get('HTTP_X_PARTIAL_XHR')
-
         org_repo = Repository.get_by_repo_name(org_repo)
         other_repo = Repository.get_by_repo_name(other_repo)
 
@@ -148,8 +150,6 @@
 
         c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
                                                    c.cs_ranges])
-        # defines that we need hidden inputs with changesets
-        c.as_form = request.GET.get('as_form', False)
         if partial:
             return render('compare/compare_cs.html')