[Twisted-Python] SMTP patch take 2

Moshe Zadka twisted at moshez.org
Mon Oct 7 07:42:46 MDT 2002


Here are some comments

On Mon, 07 Oct 2002 15:18:27 +0200, Anders Hammarquist <iko at strakt.com> wrote:

> -    def __init__(self):
> +    def __init__(self, domain, timeout=600):

This is wrong. .domain and .timeout should be attributes the protocol
gets from the factory, since they are a part of the persistenct configuration.

> +    # A string of quoted strings, backslash-escaped character or
> +    # atom characters + '@.,:'
> +    qstring = r'("[^"]*"|\\.|[' + string.replace(atom,'#',r'\#') + r'@.,:])+'

Oh, wow. Maybe have some unit tests for the correctness of the regular
expressions :)

> +    def receivedHeader(self, helo, origin, recipents):
> +        return "Received: From %s ([%s]) by %s; %s" % (
> +            helo[0], helo[1], self.host,
> +            time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()))
> +    
>      def validateFrom(self, helo, origin, success, failure):
> +        if not self.__helo:
> +            self.sendCode(503,"Who are you? Say HELO first");
               ...and fail... 
>          success(origin)




More information about the Twisted-Python mailing list