Sorry I probably didn't explain this properly. A composite backend is half
the solution, the other part of the problem is deciding which backend to
use. This decision in our case needs to be made where mail.send() is called.
Either I could load in a custom backend here and replace the default one, or
alternative pass some kwargs through send() to the send_messages() function
in the backend, allowing the composite backend to choose
the appropriate backend to use.

Does this make more sense? As in this case I cant throw an Exception easily,
as the backends wont fail, they just delay a lot, and ideally any backends
used by a composite backend should be independent of each other.

Mat


On Mon, Feb 22, 2010 at 11:49 PM, Jacob Kaplan-Moss <[email protected]>wrote:

> On Mon, Feb 22, 2010 at 12:48 PM, Mat Clayton <[email protected]> wrote:
> > Any thoughts on this as a change to the Email Backend system in django?
>
> I'm not sure why you'd need any changes to the backend system:
> couldn't you easily create a composite backend class that tried to
> send email through multiple backends? Here's my completely untested
> stab at the problem::
>
>    class IDontWanna(Exception):
>        pass
>
>    def composite_backends(*backends):
>        class CompositeEmailBackend(object):
>            def send_messages(self, messages):
>                for backend in backends:
>                    try:
>                        backend.send_messages(messages)
>                    except IDontWanna:
>                        continue
>
>    MyMultipleBackends = composite_backends(BackendOne(),
> BackendTwo(), BackendThree())
>
> Jacob
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<django-developers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>


-- 
-- 
Matthew Clayton | Founder/CEO
Wakari Limited

twitter http://www.twitter.com/matclayton

email [email protected]
mobile +44 7872007851

skype matclayton

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to