From bb9e96aed90e4df3d0dd4ec28064d5c6ad7b53d7 Mon Sep 17 00:00:00 2001 From: Ian Burnette Date: Thu, 27 Aug 2020 13:37:52 +0200 Subject: [PATCH] Removed unnecessary ContentExists exception. --- wlc/__init__.py | 9 --------- wlc/test_wlc.py | 8 -------- 2 files changed, 17 deletions(-) diff --git a/wlc/__init__.py b/wlc/__init__.py index 5b6c8fb2..6d362919 100644 --- a/wlc/__init__.py +++ b/wlc/__init__.py @@ -59,12 +59,6 @@ def __init__(self): "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.""" @@ -521,9 +515,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) diff --git a/wlc/test_wlc.py b/wlc/test_wlc.py index 8778ea15..a6c1c812 100644 --- a/wlc/test_wlc.py +++ b/wlc/test_wlc.py @@ -30,7 +30,6 @@ Weblate, WeblateException, IsNotMonolingual, - ContentExists, ) from .test_base import APITest @@ -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()