[Twisted-Python] Updated SMTP patch

Anders Hammarquist iko at cd.chalmers.se
Tue May 13 16:18:49 MDT 2003


In a message of Mon, 12 May 2003 14:39:41 EDT, Jp Calderone writes:
>> About the recent change to validateTo using a defered rather than
>> "straight" callbacks, I missed the discussion (if any), but I *strongly*
>> feel that validateTo and validateFrom should use the same method,
>> and that "failed" addresses should be communicated with failures
>> rather than "magic". So I changed it.
>
>  I don't see the behavior as magic.  It seems very analogous to str.find()
>returning -1 when nothing is found.  The main reason I chose to avoid
>failures here was to avoid the costs associated with them.  None instead of
>a username as a callback seems to indicate an invalid address as clearly as
>a failure object would.

Not magic as in not understandable, thus the quotes. It's obivous how
it works, it just doesn't feel as clean as using a failure, especially
when passing a non-standard response (the possiblity of which was
completely lost in your initial implementation). While using a failure
certainly is more expensive, the expected result is for the address to
be acceptable, so it shouldn't happen too often. So I still feel that
using failures is a cleaner approach, and if it proves too costly,
perhaps the first thing to do should be to see if the failures can be
made lighter, possibly optionally lighter for "expected" failures.

/Anders

-- 
 -- Of course I'm crazy, but that doesn't mean I'm wrong.
Anders Hammarquist                                  | iko at cd.chalmers.se
Physics student, Chalmers University of Technology, | Hem: +46 31 88 48 50
G|teborg, Sweden.           RADIO: SM6XMM and N2JGL | Mob: +46 707 27 86 87




More information about the Twisted-Python mailing list