tethys 3.2+ portal_config.yml issue

24 views
Skip to first unread message

HBW

unread,
Nov 19, 2020, 1:48:17 PM11/19/20
to Tethys Platform
I'm trying to use the ADMIN settings in the portal_config.yml file to send emails to Admins and Managers  using mail_managers(subject, message) and mail_admins(subject, message) defined at 'site-packages/django/core/mail/__init__.py' but if i use the list format (defined at Django settings ADMIN):

 ADMIN:  [('First', 'First...@example.com'), ('Second', 'Second...@example.com')]

the application throws an error:
File "/opt/miniconda3/envs/tethys/lib/python3.7/site-packages/yaml/parser.py", line 484, in parse_flow_sequence_entry
    "expected ',' or ']', but got %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a flow sequence
  in "/.tethys/portal_config.yml"

Does someone know what the format should be? I have tried several formats without success. I did use this format in the tethys_portal.settings.py and I can send email but the Tethys documents state not to put your setting there. 

 

swainn

unread,
Nov 23, 2020, 10:22:01 AM11/23/20
to Tethys Platform
Thanks for posting your question. Based on the error message, it would seem that you are missing a comma (",") or square bracket ("]"). The example above seems correct, but I'm guessing that's not exactly what you have in your portal_config.yml. Can you share exactly what you have in the portal_config.yml that is giving you this error?

You may also want to try the YAML list format:

settings:
  ADMIN:
    - ('First', 'First...@example.com')
    - ('Second', 'Second...@example.com')

HBW

unread,
Nov 27, 2020, 10:04:30 AM11/27/20
to Tethys Platform
Thank you for the assistance, after several rounds of testing I found the the format needs to be:

 ADMIN:
    - ['First', 'First...@example.com']
    - ['Second', 'Second...@example.com']

swainn

unread,
Dec 3, 2020, 1:19:01 PM12/3/20
to Tethys Platform
Ah yes, that's right. I don't think YAML supports using the tuple syntax. So the workaround is usually to convert tuples to lists. Sorry for not thinking of that sooner. Glad you figured it out.
Reply all
Reply to author
Forward
0 new messages