Commit 4e841896 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Rafael Monnerat

Check that MailHost is sane.

getMessageList shall not be available on normal mail host. It will be available
on one coming from live tests, so in such case die immediately.
parent 3fd3877b
......@@ -55,6 +55,14 @@
portal = context.getPortalObject()\n
mailhost = portal.MailHost\n
promise_url = portal.getPromiseParameter(\'external_service\', \'smtp_url\').rstrip(\'/\')\n
if getattr(mailhost, \'getMessageList\', None) is not None:\n
context.newActiveProcess().postResult(ActiveResult(\n
severity=1,\n
summary="%s/MailHost is not real MailHost" % portal.getPath(),\n
detail="Possibly comes from DummyMailHost. The object has to be fixed by recreating it."\n
))\n
return\n
\n
\n
if promise_url is None:\n
return\n
......
......@@ -52,6 +52,9 @@
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
mailhost = portal.MailHost\n
if getattr(mailhost, \'getMessageList\', None) is not None:\n
# cannot fix wrong MailHost\n
return\n
promise_url = portal.getPromiseParameter(\'external_service\', \'smtp_url\')\n
\n
protocol, promise_url = promise_url.split(\'://\', 1)\n
......
24
\ No newline at end of file
25
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment