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
ec2c6d5e
Commit
ec2c6d5e
authored
Aug 19, 2007
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UI for queue control
parent
092dee5d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
2 deletions
+59
-2
lib/python/Products/MailHost/MailHost.py
lib/python/Products/MailHost/MailHost.py
+34
-2
lib/python/Products/MailHost/dtml/manageMailHost.dtml
lib/python/Products/MailHost/dtml/manageMailHost.dtml
+25
-0
No files found.
lib/python/Products/MailHost/MailHost.py
View file @
ec2c6d5e
...
@@ -24,7 +24,7 @@ from cStringIO import StringIO
...
@@ -24,7 +24,7 @@ from cStringIO import StringIO
import
Acquisition
import
Acquisition
import
OFS.SimpleItem
import
OFS.SimpleItem
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
AccessControl.Permissions
import
change_configuration
from
AccessControl.Permissions
import
change_configuration
,
view
from
AccessControl.Permissions
import
use_mailhost_services
from
AccessControl.Permissions
import
use_mailhost_services
from
AccessControl.Permissions
import
view_management_screens
from
AccessControl.Permissions
import
view_management_screens
from
AccessControl.Role
import
RoleManager
from
AccessControl.Role
import
RoleManager
...
@@ -33,6 +33,7 @@ from DateTime import DateTime
...
@@ -33,6 +33,7 @@ from DateTime import DateTime
from
zope.interface
import
implements
from
zope.interface
import
implements
from
zope.sendmail.mailer
import
SMTPMailer
from
zope.sendmail.mailer
import
SMTPMailer
from
zope.sendmail.maildir
import
Maildir
from
zope.sendmail.delivery
import
DirectMailDelivery
,
QueuedMailDelivery
,
\
from
zope.sendmail.delivery
import
DirectMailDelivery
,
QueuedMailDelivery
,
\
QueueProcessorThread
QueueProcessorThread
...
@@ -196,7 +197,8 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
...
@@ -196,7 +197,8 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
while
thread
.
isAlive
():
while
thread
.
isAlive
():
# wait until thread is really dead
# wait until thread is really dead
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
del
queue_threads
[
path
]
LOG
.
info
(
'Thread for %s stopped'
%
path
)
def
_startQueueProcessorThread
(
self
):
def
_startQueueProcessorThread
(
self
):
""" Start thread for processing the mail queue """
""" Start thread for processing the mail queue """
...
@@ -208,6 +210,36 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
...
@@ -208,6 +210,36 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
thread
.
setQueuePath
(
self
.
smtp_queue_directory
)
thread
.
setQueuePath
(
self
.
smtp_queue_directory
)
thread
.
start
()
thread
.
start
()
queue_threads
[
path
]
=
thread
queue_threads
[
path
]
=
thread
LOG
.
info
(
'Thread for %s started'
%
path
)
security
.
declareProtected
(
view
,
'queueLength'
)
def
queueLength
(
self
):
""" return length of mail queue """
maildir
=
Maildir
(
self
.
smtp_queue_directory
)
return
len
([
item
for
item
in
maildir
])
security
.
declareProtected
(
view
,
'queueThreadAlive'
)
def
queueThreadAlive
(
self
):
""" return True/False is queue thread is working """
th
=
queue_threads
.
get
(
self
.
absolute_url
(
1
))
if
th
:
return
th
.
isAlive
()
return
False
security
.
declareProtected
(
change_configuration
,
'manage_restartQueueThread'
)
def
manage_restartQueueThread
(
self
,
REQUEST
=
None
):
""" Restart the queue processor thread """
self
.
_stopQueueProcessorThread
()
self
.
_startQueueProcessorThread
()
if
REQUEST
is
not
None
:
msg
=
'Queue processor thread restarted'
return
self
.
manage_main
(
self
,
REQUEST
,
manage_tabs_message
=
msg
)
security
.
declarePrivate
(
'_send'
)
security
.
declarePrivate
(
'_send'
)
...
...
lib/python/Products/MailHost/dtml/manageMailHost.dtml
View file @
ec2c6d5e
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
<input type="text" name="smtp_uid" size="15"
<input type="text" name="smtp_uid" size="15"
value="&dtml-smtp_uid;"/>
value="&dtml-smtp_uid;"/>
</td>
</td>
<dtml-var "smtp_uid" >
<td>
<td>
<span class="form-help">(optional for SMTP AUTH)</span>
<span class="form-help">(optional for SMTP AUTH)</span>
</td>
</td>
...
@@ -114,6 +115,30 @@
...
@@ -114,6 +115,30 @@
</div>
</div>
</td>
</td>
</tr>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Mails in queue <br/>
</div>
</td>
<td align="left" valign="top">
<span class="form-help"><dtml-var queueLength></span>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Queue processor thread alive?<br/>
</div>
</td>
<td align="left" valign="top">
<div class="form-help">
<dtml-var queueThreadAlive>
<br/>
<a href="manage_restartQueueThread">Restart queue processor thread</a> (this may take some seconds)
</div>
</td>
</tr>
</table>
</table>
</form>
</form>
...
...
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