[Twisted-Python] smtp.SMTP help

Jp Calderone exarkun at intarweb.us
Fri Oct 3 22:04:03 EDT 2003


On Fri, Oct 03, 2003 at 01:27:47PM -0400, Greg wrote:
> Actually, I tried returning an instance (i.e. "return MyMessage()" ) 
> here on my first shot at this, but I got:
> 
> File "/usr/lib/python2.2/site-packages/twisted/protocols/smtp.py", line 
> 672, i
> n do_DATA
>    self.__messages = [f() for (u, f) in recipients]
> exceptions.AttributeError: MyMessage instance has no __call__ method

  Woops, sorry.  It needs to be a *callable* that returns an instance.  So
the class is fine, if you don't need to associate the user with it,
otherwise "lambda: MyMessage(user)" is probably the way to go.

  Jp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20031003/f38ec3df/attachment.pgp 


More information about the Twisted-Python mailing list