plugin invitations: raise ValueError if url_template and message_body are both not specified

This commit is contained in:
Goffi 2017-03-29 19:30:29 +02:00
commit 594cf2d02a

View file

@ -112,7 +112,7 @@ class InvitationsPlugin(object):
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 @@ class InvitationsPlugin(object):
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())