diff --git a/jdav_web/mailer/models.py b/jdav_web/mailer/models.py index e276772..e9a5199 100644 --- a/jdav_web/mailer/models.py +++ b/jdav_web/mailer/models.py @@ -232,7 +232,7 @@ class Attachment(CommonModel): max_upload_size=10) def __str__(self): - return os.path.basename(self.f.name) if self.f.name else _("Empty") + return os.path.basename(self.f.name) if self.f.name else str(_("Empty")) class Meta: verbose_name = _('attachment') diff --git a/jdav_web/mailer/tests/models.py b/jdav_web/mailer/tests/models.py index feaed68..51e183f 100644 --- a/jdav_web/mailer/tests/models.py +++ b/jdav_web/mailer/tests/models.py @@ -267,6 +267,5 @@ class AttachmentTestCase(BasicMailerTestCase): self.attachment.f.name = 'attachments/test_document.pdf' self.assertEqual(str(self.attachment), 'test_document.pdf') - @skip('Fails with TypeError: __str__ returns a lazy translation object, but must return a string.') def test_str_without_file(self): self.assertEqual(str(self.attachment), _('Empty'))