Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
c47a68e8
Commit
c47a68e8
authored
Jan 15, 2002
by
Jens Vagelpohl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor MailHost construction and initialization
parent
e48dee99
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
26 deletions
+17
-26
lib/python/Products/MailHost/MailHost.py
lib/python/Products/MailHost/MailHost.py
+14
-22
lib/python/Products/MailHost/SendMailTag.py
lib/python/Products/MailHost/SendMailTag.py
+3
-4
No files found.
lib/python/Products/MailHost/MailHost.py
View file @
c47a68e8
...
...
@@ -12,8 +12,8 @@
##############################################################################
"""SMTP mail objects
$Id: MailHost.py,v 1.6
5 2002/01/15 04:05:12
jens Exp $"""
__version__
=
"$Revision: 1.6
5
$"
[
11
:
-
2
]
$Id: MailHost.py,v 1.6
6 2002/01/15 04:23:08
jens Exp $"""
__version__
=
"$Revision: 1.6
6
$"
[
11
:
-
2
]
from
Globals
import
Persistent
,
DTMLFile
,
MessageDialog
,
InitializeClass
from
smtplib
import
SMTP
...
...
@@ -30,25 +30,13 @@ smtpError = "SMTP Error"
MailHostError
=
"MailHost Error"
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 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
)
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
...
...
lib/python/Products/MailHost/SendMailTag.py
View file @
c47a68e8
...
...
@@ -10,8 +10,8 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
__rcs_id__
=
'$Id: SendMailTag.py,v 1.1
3 2001/11/28 15:50:59 matt
Exp $'
__version__
=
'$Revision: 1.1
3
$'
[
11
:
-
2
]
__rcs_id__
=
'$Id: SendMailTag.py,v 1.1
4 2002/01/15 04:23:08 jens
Exp $'
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
from
MailHost
import
MailBase
from
DocumentTemplate.DT_Util
import
parse_params
,
render_blocks
...
...
@@ -109,8 +109,7 @@ class SendMailTag:
if
self
.
mailhost
:
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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment