[Zope-dev] MailHost from 2.5.1 does not work in 2.6.0

Clemens Robbenhaar zope-dev@zope.org
Tue, 26 Nov 2002 23:46:11 +0100


... moving discussion from zope@zope.org to zope-dev@zope.org

Actually the topic has been that the "smtp_port" attribute of a MailHost
has changed type from string in 2.5.1 to int in 2.6.0


 > >  I guessed a little hint about this incompatibility in the release notes
 > > would have been nice, but I can find nothing in this regard.
 > 
 > I don't think anybody really was aware of it... :-/
 > It has to be fixed to 2.6.1 of course.
 > 
 > The question is: Should the fix be to cast the smtp_port into an int every
 > use (simple, functional, safe, ugly) or something else?

 Personally I guess it would be enough if there would be a notification
that one should update the MailHost instances after upgrading.
It is really easy; push the "save" button of the "Edit" tab fixes the
issue without ado.

 That's actually very easy, and could be simulated by some script if one
has more than N MailHost instances in one Zope instance (where N depends
ones patience when clicking through the ZMI ;-)

OTOH, there is exactly one place, where the smtp_host atrribute is used;
lib/python/Products/MailHost/MailHost.py, line 214ff:

    security.declarePrivate( '_send' )
    def _send( self, mfrom, mto, messageText ):
        """ Send the message """
        smtpserver = SMTP( self.smtp_host, self.smtp_port ) # <-- here
        smtpserver.sendmail( mfrom, mto, messageText )
        smtpserver.quit()

Thus if one does not trust people to read release notes, one could
pragmatically add the int(...) cast here to avoid traffic on
zope@zope.org, though the cast is superfluous most of the time. 

 [...]
 > I checked some history. Up to 2.4 it was stored as an integer. For some
 > reason it was changed between the final 2.5 beta and 2.5 release to be
 > stored as a string, and then cast into an integer each time it was used. I
 > don't know the rationale behind this change.
 [...]

 Well, if the change in 2.6.0 is actually a change _back_ to an old
type, and nobody has complained about the change in 2.5, then it is
maybe an unlucky accident Jan Ulrich Hasecke and me have created MailHost
in 2.5.1, and everybody else will simply skip over this without
notice. In this case my reply is too long already  ;-)

cheers,
clemens