[Zope-Checkins] CVS: Zope/lib/python/Products/MailHost - MailHost.py:1.66 SendMailTag.py:1.14
Jens Vagelpohl
jens@zope.com
Mon, 14 Jan 2002 23:23:08 -0500
Update of /cvs-repository/Zope/lib/python/Products/MailHost
In directory cvs.zope.org:/tmp/cvs-serv13460
Modified Files:
MailHost.py SendMailTag.py
Log Message:
Refactor MailHost construction and initialization
=== Zope/lib/python/Products/MailHost/MailHost.py 1.65 => 1.66 ===
manage_addMailHostForm=DTMLFile('dtml/addMailHost_form', globals())
-def manage_addMailHost(self, id, title='', smtp_host=None,
- localhost='localhost', smtp_port=25,
- timeout=1.0, REQUEST=None):
+def manage_addMailHost( self, id, title='', smtp_host='localhost'
+ , localhost='localhost', smtp_port=25
+ , timeout=1.0, REQUEST=None ):
' add a MailHost into the system '
+ i = MailHost( id, title, smtp_host, smtp_port ) #create new mail host
+ self._setObject( id,i ) #register it
- id=str(id)
- title=str(title)
- if smtp_host is not None:
- smtp_host=str(smtp_host)
- if type(smtp_port) is not type(1):
- smtp_port=string.atoi(smtp_port)
-
- i=MailHost() #create new mail host
- i.id=id #give it id
- i.title=title #title
- i._init(smtp_host=smtp_host, smtp_port=smtp_port)
-
- self=self.this()
- self._setObject(id,i) #register it
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
@@ -75,10 +63,14 @@
)
- def __init__(self):
- 'nothing yet'
- pass
+ def __init__( self, id='', title='', smtp_host='localhost', smtp_port=25 ):
+ """Initialize a new MailHost instance """
+ self.id = id
+ self.title = title
+ self.smtp_host = str( smtp_host )
+ self.smtp_port = str( smtp_port )
+ # staying for now... (backwards compatibility)
def _init(self, smtp_host, smtp_port):
self.smtp_host=smtp_host
self.smtp_port=smtp_port
=== Zope/lib/python/Products/MailHost/SendMailTag.py 1.13 => 1.14 ===
mhost=md[self.mailhost]
elif self.smtphost:
- mhost=MailBase()
- mhost._init(self.smtphost, self.port)
+ mhost=MailBase( self.smtphost, self.port )
mhost.send(render_blocks(self.section.blocks, md),
self.mailto, self.mailfrom,