Skip to content

Commit

Permalink
Merge pull request WeblateOrg#6 from blackfedora/component-add-transl…
Browse files Browse the repository at this point in the history
…ation

Removed unnecessary ContentExists exception.
  • Loading branch information
superDross authored Sep 1, 2020
2 parents c8d47a8 + bb9e96a commit 9a8c3bf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
9 changes: 0 additions & 9 deletions wlc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ class IsNotMonolingual(WeblateException):
def __init__(self):
super().__init__("Source strings can only be added to monolingual components")

class ContentExists(WeblateException):
def __init__(self):
super().__init__(
"Conflict, content exists at this address. "
"Try updating the existing content instead."
)

class Weblate:
"""Weblate API wrapper object."""
Expand Down Expand Up @@ -559,9 +553,6 @@ def list(self):
def add_translation(self, language):
"""Creates a new translation in the component"""
self.ensure_loaded("translations_url")
language_list = [l["language"]["code"] for l in self.list()]
if language in language_list:
raise ContentExists()
return self.weblate.post(path=self._attribs["translations_url"],
language_code=language)

Expand Down
8 changes: 0 additions & 8 deletions wlc/test_wlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
Weblate,
WeblateException,
IsNotMonolingual,
ContentExists,
)

from .test_base import APITest
Expand Down Expand Up @@ -391,13 +390,6 @@ def test_add_translation(self):
self.assertEqual(resp["data"]["revision"],
"da6ea2777f61fbe1d2a207ff6ebdadfa15f26d1a")

def test_add_existing_translation(self):
"""Check that a ContentExists error is raised"""
with self.assertRaises(ContentExists):
obj = self.get()
obj.add_translation("sv")


def test_statistics(self):
"""Component statistics test."""
obj = self.get()
Expand Down

0 comments on commit 9a8c3bf

Please sign in to comment.