From fdef6688adfe5f986bdfd5cbd3c899fb578199b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 11 Jun 2016 20:37:26 +0200 Subject: [PATCH] hobo: digest emails parameters sent by hobo (#11309) --- tests/test_hobo.py | 4 ++++ wcs/ctl/check_hobos.py | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/tests/test_hobo.py b/tests/test_hobo.py index e9c20f4..3d65e79 100644 --- a/tests/test_hobo.py +++ b/tests/test_hobo.py @@ -167,6 +167,8 @@ HOBO_JSON = { }, 'variables': { 'foobar': 'http://example.net', + 'email_signature': 'Hello world.', + 'default_from_email': 'noreply@example.net', }, 'users': [ { @@ -208,6 +210,8 @@ def test_update_configuration(): service = [x for x in HOBO_JSON.get('services', []) if x.get('service-id') == 'wcs'][0] hobo_cmd.update_configuration(service, pub) assert pub.cfg['misc']['sitename'] == 'Test wcs' + assert pub.cfg['emails']['footer'] == 'Hello world.' + assert pub.cfg['emails']['from'] == 'noreply@example.net' def test_update_profile(): profile = HOBO_JSON.get('profile') diff --git a/wcs/ctl/check_hobos.py b/wcs/ctl/check_hobos.py index 6cbb6fd..dc92798 100644 --- a/wcs/ctl/check_hobos.py +++ b/wcs/ctl/check_hobos.py @@ -135,6 +135,17 @@ class CmdCheckHobos(Command): pub.cfg['misc']['frontoffice-url'] = service.get('base_url').encode('utf-8') if not pub.cfg.get('language'): pub.cfg['language'] = {'language': 'fr'} + + if not pub.cfg.get('emails'): + pub.cfg['emails'] = {} + + variables = self.all_services.get('variables') or {} + variables.update(service.get('variables') or {}) + if variables.get('default_from_email'): + pub.cfg['emails']['from'] = variables.get('default_from_email').encode('utf-8') + if variables.get('email_signature') is not None: + pub.cfg['emails']['footer'] = variables.get('email_signature').encode('utf-8') + pub.write_cfg() def update_profile(self, profile, pub): -- 2.8.1