Mercurial > libervia-backend
changeset 2210:f8d61592f1fc
plugin invitations: raise ValueError if url_template and message_body are both not specified
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 29 Mar 2017 19:30:29 +0200 |
parents | ea41cf1e6d29 |
children | df115e4a36c7 |
files | src/plugins/plugin_misc_invitations.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/plugin_misc_invitations.py Wed Mar 29 19:27:52 2017 +0200 +++ b/src/plugins/plugin_misc_invitations.py Wed Mar 29 19:30:29 2017 +0200 @@ -112,7 +112,7 @@ use None if you don't want to include URL (or if it is already specified in custom message) /!\ you must put full URL, don't forget https:// /!\ the URL will give access to the invitee account, you should warn in message to not publish it publicly - message_subject(unicode, None): customised message body for t:o he invitation email + message_subject(unicode, None): customised message body for the invitation email None to use default subject uses the same substitution as for message_body message_body(unicode, None): customised message body for the invitation email @@ -143,6 +143,10 @@ raise exceptions.ValueError(_(u"You can't use following key(s) in extra, they are reserved: {}").format( u', '.join(EXTRA_RESERVED.intersection(extra)))) + if not 'url_template' in extra and not 'message_body' in extra: + raise ValueError(_(u"You need to provide url_template if you use default message body")) + + ## uuid log.info(_(u"creating an invitation")) id_ = unicode(shortuuid.uuid())