# HG changeset patch # User Goffi # Date 1490808629 -7200 # Node ID f8d61592f1fcf2da96864d137d02f070f0776ecc # Parent ea41cf1e6d29b84169976010cfe059a11e68f81b plugin invitations: raise ValueError if url_template and message_body are both not specified diff -r ea41cf1e6d29 -r f8d61592f1fc src/plugins/plugin_misc_invitations.py --- 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())