Skip to content
This repository

fix bug 765647: Properly handle "edit" button as translation request #346

Merged
merged 1 commit into from almost 2 years ago

2 participants

Les Orchard David Walsh
Les Orchard
Collaborator

No description provided.

David Walsh
Collaborator

Fixes the issue described in bug; I found a side effect of this, but will fix in different PR. r+

David Walsh darkwing merged commit 3ac0c16 into from July 05, 2012
David Walsh darkwing closed this July 05, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
17  apps/wiki/tests/test_views.py
@@ -616,7 +616,6 @@ def test_create_on_404(self):
616 616
         response = client.get(reverse('wiki.document', args=[slug], locale=locale))
617 617
         eq_(302, response.status_code)
618 618
 
619  
-
620 619
     def test_retitling(self):
621 620
         """When the title of an article is edited, a redirect is made."""
622 621
         # Not testing slug changes separately; the model tests cover those plus
@@ -914,8 +913,6 @@ def test_parent_child_slug_built_properly(self):
914 913
         grandchild_doc = child_doc.children.all()[0]
915 914
         eq_(grandchild_doc.slug, child_doc.slug + '/' + grandchild_data['slug'])
916 915
 
917  
-
918  
-
919 916
     def test_localized_based_on(self):
920 917
         """Editing a localized article 'based on' an older revision of the
921 918
         localization is OK."""
@@ -1180,6 +1177,20 @@ def test_parent_topic(self):
1180 1177
         ok_(d.children.count() == 1)
1181 1178
         ok_(d.children.all()[0].title == 'Replicated local storage')
1182 1179
 
  1180
+    def test_translate_on_edit(self):
  1181
+        d1 = document(title="Doc1", locale='en-US', save=True)
  1182
+        r1 = revision(document=d1, save=True)
  1183
+
  1184
+        d2 = document(title="TransDoc1", locale='de', parent=d1, save=True)
  1185
+        r2 = revision(document=d2, save=True)
  1186
+
  1187
+        client = LocalizingClient()
  1188
+        client.login(username='admin', password='testpass')
  1189
+        url = reverse('wiki.edit_document', args=(d2.slug,), locale=d2.locale)
  1190
+
  1191
+        resp = client.get(url)
  1192
+        eq_(200, resp.status_code)
  1193
+
1183 1194
     def test_revisions_feed(self):
1184 1195
         d = document(title='HTML9')
1185 1196
         d.save()
2  apps/wiki/views.py
@@ -1004,7 +1004,7 @@ def translate(request, document_slug, document_locale, revision_id=None):
1004 1004
         # param is the best way to avoid the MindTouch-legacy locale
1005 1005
         # redirection logic.
1006 1006
         document_locale = request.REQUEST.get('tolocale',
1007  
-                                              settings.WIKI_DEFAULT_LANGUAGE)
  1007
+                                              document_locale)
1008 1008
 
1009 1009
     # Handle parent slug
1010 1010
     full_parent_slug = document_slug
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.