diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-11-23 11:48:25 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2015-11-23 17:25:39 -0300 |
commit | 0900c714facb04bd7c990905a3578a703f4e9988 (patch) | |
tree | 7e0621772d74b7cbcaec22bd768d253e1e09c5cf /service | |
parent | ac4425ce923143d7d9d50ffed720211858b9834f (diff) |
Checking on deletion errors on drafts isnt needed
As delete_mail checks for mail_id there will be no more need to create
errors.
--Issue #512
Diffstat (limited to 'service')
-rw-r--r-- | service/pixelated/adapter/services/draft_service.py | 11 | ||||
-rw-r--r-- | service/test/unit/adapter/test_draft_service.py | 2 |
2 files changed, 3 insertions, 10 deletions
diff --git a/service/pixelated/adapter/services/draft_service.py b/service/pixelated/adapter/services/draft_service.py index d8e0f6dd..30d3020d 100644 --- a/service/pixelated/adapter/services/draft_service.py +++ b/service/pixelated/adapter/services/draft_service.py @@ -30,13 +30,6 @@ class DraftService(object): @defer.inlineCallbacks def update_draft(self, ident, input_mail): + yield self._mail_store.delete_mail(ident) new_draft = yield self.create_draft(input_mail) - try: - yield self._mail_store.delete_mail(ident) - defer.returnValue(new_draft) - except Exception as error: - errorMessage = error.args[0].getErrorMessage() - - if errorMessage == 'Need to create doc before deleting': - yield self._mail_store.delete_mail(new_draft.ident) - raise DuplicatedDraftException(errorMessage) + defer.returnValue(new_draft) diff --git a/service/test/unit/adapter/test_draft_service.py b/service/test/unit/adapter/test_draft_service.py index c2b7cd93..628b95d4 100644 --- a/service/test/unit/adapter/test_draft_service.py +++ b/service/test/unit/adapter/test_draft_service.py @@ -27,5 +27,5 @@ class DraftServiceTest(unittest.TestCase): self.draft_service.update_draft(mail.ident, mail) - inorder.verify(self.mail_store).add_mail('DRAFTS', mail.raw) inorder.verify(self.mail_store).delete_mail(mail.ident) + inorder.verify(self.mail_store).add_mail('DRAFTS', mail.raw) |