Mercurial > kallithea
comparison rhodecode/lib/rcmail/message.py @ 2452:d95ef6587bca beta
fixes #481 rhodecode emails are sent without Date header
- small code cleanup in mailing
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 13 Jun 2012 23:44:32 +0200 |
parents | 69e95ad5b6f0 |
children | 7e5f8c12a3fc |
comparison
equal
deleted
inserted
replaced
2451:402a96fcfa22 | 2452:d95ef6587bca |
---|---|
1 from rhodecode.lib.rcmail.response import MailResponse | 1 from rhodecode.lib.rcmail.response import MailResponse |
2 | 2 |
3 from rhodecode.lib.rcmail.exceptions import BadHeaders | 3 from rhodecode.lib.rcmail.exceptions import BadHeaders |
4 from rhodecode.lib.rcmail.exceptions import InvalidMessage | 4 from rhodecode.lib.rcmail.exceptions import InvalidMessage |
5 | |
5 | 6 |
6 class Attachment(object): | 7 class Attachment(object): |
7 """ | 8 """ |
8 Encapsulates file attachment information. | 9 Encapsulates file attachment information. |
9 | 10 |
132 """ | 133 """ |
133 Checks if message is valid and raises appropriate exception. | 134 Checks if message is valid and raises appropriate exception. |
134 """ | 135 """ |
135 | 136 |
136 if not self.recipients: | 137 if not self.recipients: |
137 raise InvalidMessage, "No recipients have been added" | 138 raise InvalidMessage("No recipients have been added") |
138 | 139 |
139 if not self.body and not self.html: | 140 if not self.body and not self.html: |
140 raise InvalidMessage, "No body has been set" | 141 raise InvalidMessage("No body has been set") |
141 | 142 |
142 if not self.sender: | 143 if not self.sender: |
143 raise InvalidMessage, "No sender address has been set" | 144 raise InvalidMessage("No sender address has been set") |
144 | 145 |
145 if self.is_bad_headers(): | 146 if self.is_bad_headers(): |
146 raise BadHeaders | 147 raise BadHeaders |
147 | 148 |
148 def add_recipient(self, recipient): | 149 def add_recipient(self, recipient): |