4teamwork/ftw.mail — pull request #15 by jone (2014-03-27 15:52:02+00:00)
Title: Inbound error handling

This PR refactors and cleans up the inbound view.
These changes allow to easily override e.g. the new `inbound()` method and catch and handle exceptions very specifically.
This makes it possible to send well-layouted mails as answer for specific problems, such as the user is not registered in the system (which usually means the user sent the mail from the wrong account).

- Exceptions are split up into more specific exceptions, all subclassing `MailInboundException`
- The `render` is stripped down to a minimum, only calling `self.inbound()` and thus allowing to customize and wrap `inbound` with error handling.
- The tests are extended with some use cases (e.g. configuration settings) which were not tested before.
- Various refactorings of the code and cleanups.

The behavior of mail-in stays exactly the same, only the code internally is changed. The only thing that I changed is the error message when the received mail has no sender information (which should not be a realistic use case anyways):
- Old: ``77:Unknown sender. Permission denied.`
- New: ``77:Could not extract sender email.``

@lukasgraf @buchi @maethu please take a look