Skip to content

Loading…

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

Merged
merged 1 commit into from

2 participants

@lmorchard
Mozilla member

No description provided.

@darkwing
Mozilla member

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

@darkwing darkwing merged commit 3ac0c16 into mozilla:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 15 additions and 4 deletions.
  1. +14 −3 apps/wiki/tests/test_views.py
  2. +1 −1 apps/wiki/views.py
View
17 apps/wiki/tests/test_views.py
@@ -616,7 +616,6 @@ def test_create_on_404(self):
response = client.get(reverse('wiki.document', args=[slug], locale=locale))
eq_(302, response.status_code)
-
def test_retitling(self):
"""When the title of an article is edited, a redirect is made."""
# Not testing slug changes separately; the model tests cover those plus
@@ -914,8 +913,6 @@ def test_parent_child_slug_built_properly(self):
grandchild_doc = child_doc.children.all()[0]
eq_(grandchild_doc.slug, child_doc.slug + '/' + grandchild_data['slug'])
-
-
def test_localized_based_on(self):
"""Editing a localized article 'based on' an older revision of the
localization is OK."""
@@ -1180,6 +1177,20 @@ def test_parent_topic(self):
ok_(d.children.count() == 1)
ok_(d.children.all()[0].title == 'Replicated local storage')
+ def test_translate_on_edit(self):
+ d1 = document(title="Doc1", locale='en-US', save=True)
+ r1 = revision(document=d1, save=True)
+
+ d2 = document(title="TransDoc1", locale='de', parent=d1, save=True)
+ r2 = revision(document=d2, save=True)
+
+ client = LocalizingClient()
+ client.login(username='admin', password='testpass')
+ url = reverse('wiki.edit_document', args=(d2.slug,), locale=d2.locale)
+
+ resp = client.get(url)
+ eq_(200, resp.status_code)
+
def test_revisions_feed(self):
d = document(title='HTML9')
d.save()
View
2 apps/wiki/views.py
@@ -1004,7 +1004,7 @@ def translate(request, document_slug, document_locale, revision_id=None):
# param is the best way to avoid the MindTouch-legacy locale
# redirection logic.
document_locale = request.REQUEST.get('tolocale',
- settings.WIKI_DEFAULT_LANGUAGE)
+ document_locale)
# Handle parent slug
full_parent_slug = document_slug
Something went wrong with that request. Please try again.