comparison src/plugins/plugin_misc_invitations.py @ 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 c316c6f6a737
children df115e4a36c7
comparison
equal deleted inserted replaced
2209:ea41cf1e6d29 2210:f8d61592f1fc
110 url_template(unicode, None): template to use to construct the invitation URL 110 url_template(unicode, None): template to use to construct the invitation URL
111 use {uuid} as a placeholder for identifier 111 use {uuid} as a placeholder for identifier
112 use None if you don't want to include URL (or if it is already specified in custom message) 112 use None if you don't want to include URL (or if it is already specified in custom message)
113 /!\ you must put full URL, don't forget https:// 113 /!\ you must put full URL, don't forget https://
114 /!\ the URL will give access to the invitee account, you should warn in message to not publish it publicly 114 /!\ the URL will give access to the invitee account, you should warn in message to not publish it publicly
115 message_subject(unicode, None): customised message body for t:o he invitation email 115 message_subject(unicode, None): customised message body for the invitation email
116 None to use default subject 116 None to use default subject
117 uses the same substitution as for message_body 117 uses the same substitution as for message_body
118 message_body(unicode, None): customised message body for the invitation email 118 message_body(unicode, None): customised message body for the invitation email
119 None to use default body 119 None to use default body
120 use {name} as a place holder for invitee name 120 use {name} as a place holder for invitee name
140 u', '.join(set(kwargs).intersection(extra)))) 140 u', '.join(set(kwargs).intersection(extra))))
141 141
142 if EXTRA_RESERVED.intersection(extra): 142 if EXTRA_RESERVED.intersection(extra):
143 raise exceptions.ValueError(_(u"You can't use following key(s) in extra, they are reserved: {}").format( 143 raise exceptions.ValueError(_(u"You can't use following key(s) in extra, they are reserved: {}").format(
144 u', '.join(EXTRA_RESERVED.intersection(extra)))) 144 u', '.join(EXTRA_RESERVED.intersection(extra))))
145
146 if not 'url_template' in extra and not 'message_body' in extra:
147 raise ValueError(_(u"You need to provide url_template if you use default message body"))
148
145 149
146 ## uuid 150 ## uuid
147 log.info(_(u"creating an invitation")) 151 log.info(_(u"creating an invitation"))
148 id_ = unicode(shortuuid.uuid()) 152 id_ = unicode(shortuuid.uuid())
149 153