[damned-lies] Fix diff view in archived actions



commit 5ae2936790ea587a106c6370bad69449b3dda317
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Aug 22 18:05:40 2009 +0200

    Fix diff view in archived actions
    
    Pass the level parameter to the diff view also, so as it can
    determine if the action to query is from ActionDb or ActionDbArchived.

 templates/vertimus/vertimus_detail.html |    2 +-
 vertimus/urls.py                        |    8 ++++----
 vertimus/views.py                       |    4 +++-
 3 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/templates/vertimus/vertimus_detail.html b/templates/vertimus/vertimus_detail.html
index 2d8b552..b6f49f2 100644
--- a/templates/vertimus/vertimus_detail.html
+++ b/templates/vertimus/vertimus_detail.html
@@ -138,7 +138,7 @@ $(document).ready(function() {
           {% endif %}
           <div class="right_actions">{% trans "diff with:" %}
             {% for f in files %}
-                <a href="{% url vertimus_diff action.id,f.action_id %}" title="{{ f.title }}">[{{ forloop.revcounter }}]</a>
+                <a href="{% url vertimus_diff action.id,f.action_id,level %}" title="{{ f.title }}">[{{ forloop.revcounter }}]</a>
             {% endfor %}
           </div>
         {% endif %}
diff --git a/vertimus/urls.py b/vertimus/urls.py
index f1fcd3d..8a60ea8 100644
--- a/vertimus/urls.py
+++ b/vertimus/urls.py
@@ -10,6 +10,10 @@ urlpatterns = patterns('vertimus.views',
         view = 'vertimus_by_ids',
         name = 'vertimus_by_ids'),
     url(
+        regex = r'^diff/(?P<action_id_1>\d+)/(?P<action_id_2>\d+)/(?P<level>\d+)/$',
+        view = 'vertimus_diff',
+        name = 'vertimus_diff'),
+    url(
         regex = '^(?P<module_name>[\w\+\-\.]+)/(?P<branch_name>[\w\-\.]+)/(?P<domain_name>[\w\-]+)/(?P<locale_name>[\w\- ]+)/level(?P<level>\d+)/$',
         view = 'vertimus_by_names',
         name = 'vertimus_archives_by_names'),
@@ -17,8 +21,4 @@ urlpatterns = patterns('vertimus.views',
         regex = r'^(?P<module_name>[\w\+\-\.]+)/(?P<branch_name>[\w\-\.]+)/(?P<domain_name>[\w\-]+)/(?P<locale_name>[\w\- ]+)',
         view = 'vertimus_by_names',
         name = 'vertimus_by_names'),
-    url(
-        regex = r'^diff/(?P<action_id_1>\d+)/(?P<action_id_2>\d+)?$',
-        view = 'vertimus_diff',
-        name = 'vertimus_diff'),
 )
diff --git a/vertimus/views.py b/vertimus/views.py
index 61aa6a5..07dddf4 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -140,9 +140,11 @@ def vertimus(request, branch, domain, language, stats=None, level="0"):
                               context_instance=RequestContext(request))
 
 
-def vertimus_diff(request, action_id_1, action_id_2=None):
+def vertimus_diff(request, action_id_1, action_id_2, level):
     """Show a diff between current action po file and previous file"""
     import difflib
+    if level != 0:
+        ActionDb = ActionDbArchived
     action_1 = get_object_or_404(ActionDb, pk=action_id_1).get_action()
     state = action_1.state
 



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