On Wednesday 30 October 2013 11:23:07 unai wrote:
> 
> Now, this ticket doubts between two possible solutions. The first of them
> is returning a `(receiver, (type, exception, traceback))` made by
> `(receiver, sys.exc_info())` tuple if `exc_info` is True:
> 
>     for receiver, (typ, exc, tbk) in my_signal.send_robust(exc_info=True):
>         ...
> 
> The second solution is to attach the traceback to the exception, a la
> Python 3, at its `__traceback__` attribute.
> 
> The two solutions are backwards compatible. Personally, I prefer the second
> one because it's the way to go on Python 3, it doesn't add extra
> parameters for maintaining backwards compatibility and doesn't return a
> messy list of tuple of tuples.
> 
> But there's already a patch with tests from two years ago implementing
> solution #1. So what do you think? Do I try to recover the patch with the
> first solution or do I go with the second one?
> 
I wouldn't go telling you to do more work than you think is necessary, but if 
you're willing to do eithr, I'd prefer to see the second solution in Django; 
for all the reasons you gave, plus it is "more backward compatible": Assume I 
have some code doing

     for receiver, response in my_signal.send_robust(sender):
        if isinstance(response, Exception):
            my_error_signal.send_robust(sender, exc=response)

With the second solution, I only need to fix the receivers of the error signal 
to enjoy the benefits; With the first, I'll need to fix both the receivers and 
the signal-sending code, which may be out of my control.

Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/201310302108.13510.shai%40platonix.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to