[Twisted-Python] Improvements to twisted.protocols.smtp

Anders Hammarquist iko at cd.chalmers.se
Tue Oct 1 19:05:26 EDT 2002


In a message of 01 Oct 2002 09:02:27 -0000, Moshe Zadka writes:
>> Index: twisted/protocols/smtp.py
>
>I have a general problem here: the REs are very complicated and undocumen
>ted.
>Please use re.X and comment the RE

Ok, they can probably be improved as well. I'll look over them some more.

>> -class User:
>> +class User(Address):
>
>I'd prefer containment rather than inclusion here.

Any particular reason? I don't feel strongly either way...

>> +            del self.__messages
>> +        self.sendCode(500, 'Line too long')
>
>this seems like it wouldn't work. the client would send the rest of the
>long line, which look like a beginning of a command

You're right, of course. Setting raw mode and reading until we see
a newline should fix it. I guess the fact that sendmail gets this
wrong too is no excuse ;-)

>> +        if not self.__helo:
>> +            self.sendCode(503,"Who are you? Say HELO first");
>
>be liberal, at least in the framework. if a user wants to allow
>nonusing of helo, he should be free to do this. you can enforce helo
>in validateFrom

Right

>> -        self.__init__()
>> +        self.__from = None
>> +        self.__to = []
>>          self.sendCode(250, 'I remember nothing.')
>what about __messages?

It's only valid inside a DATA command, so it's not around to be
reset.

I'll integrate your thoughts and send a new patch in a few days.

/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