Commit 015b8ce6 authored by Łukasz Nowak's avatar Łukasz Nowak

Do not play with smtp_url too early.

smtp_url can be None, so do not treat it as string, allow to take different
actions (like doing nothing).
parent 4ba4432a
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
mailhost = portal.MailHost\n mailhost = portal.MailHost\n
promise_url = portal.getPromiseParameter(\'external_service\', \'smtp_url\').rstrip(\'/\')\n
if getattr(mailhost, \'getMessageList\', None) is not None:\n if getattr(mailhost, \'getMessageList\', None) is not None:\n
context.newActiveProcess().postResult(ActiveResult(\n context.newActiveProcess().postResult(ActiveResult(\n
severity=1,\n severity=1,\n
...@@ -63,10 +62,12 @@ if getattr(mailhost, \'getMessageList\', None) is not None:\n ...@@ -63,10 +62,12 @@ if getattr(mailhost, \'getMessageList\', None) is not None:\n
))\n ))\n
return\n return\n
\n \n
promise_url = portal.getPromiseParameter(\'external_service\', \'smtp_url\')\n
\n \n
if promise_url is None:\n if promise_url is None:\n
return\n return\n
\n \n
promise_url = promise_url.rstrip(\'/\')\n
if mailhost.force_tls:\n if mailhost.force_tls:\n
protocol = \'smtps\'\n protocol = \'smtps\'\n
else:\n else:\n
......
...@@ -57,6 +57,9 @@ if getattr(mailhost, \'getMessageList\', None) is not None:\n ...@@ -57,6 +57,9 @@ if getattr(mailhost, \'getMessageList\', None) is not None:\n
return\n return\n
promise_url = portal.getPromiseParameter(\'external_service\', \'smtp_url\')\n promise_url = portal.getPromiseParameter(\'external_service\', \'smtp_url\')\n
\n \n
if promise_url is None:\n
return\n
\n
protocol, promise_url = promise_url.split(\'://\', 1)\n protocol, promise_url = promise_url.split(\'://\', 1)\n
\n \n
if protocol == \'smtps\':\n if protocol == \'smtps\':\n
......
25 26
\ No newline at end of file \ 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