Mercurial > libervia-backend
comparison src/plugins/plugin_misc_invitations.py @ 2255:ba613d32ca60
plugin invitations: doesn't raise an exception anymore if url_template is not set while email is not requested
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 21 May 2017 20:07:54 +0200 |
parents | f87b673c7d17 |
children | 61e836cc9512 |
comparison
equal
deleted
inserted
replaced
2254:6297817c3dc9 | 2255:ba613d32ca60 |
---|---|
163 raise ValueError(_(u"You can't use following key(s) in both args and extra: {}").format( | 163 raise ValueError(_(u"You can't use following key(s) in both args and extra: {}").format( |
164 u', '.join(set(kwargs).intersection(extra)))) | 164 u', '.join(set(kwargs).intersection(extra)))) |
165 | 165 |
166 self.checkExtra(extra) | 166 self.checkExtra(extra) |
167 | 167 |
168 if not 'url_template' in kwargs and not 'message_body' in kwargs: | 168 email = kwargs.pop(u'email', None) |
169 | |
170 if email is not None and not 'url_template' in kwargs and not 'message_body' in kwargs: | |
169 raise ValueError(_(u"You need to provide url_template if you use default message body")) | 171 raise ValueError(_(u"You need to provide url_template if you use default message body")) |
170 | 172 |
171 | 173 |
172 ## uuid | 174 ## uuid |
173 log.info(_(u"creating an invitation")) | 175 log.info(_(u"creating an invitation")) |
227 | 229 |
228 ## email | 230 ## email |
229 language = kwargs.pop(u'language', None) | 231 language = kwargs.pop(u'language', None) |
230 if language is not None: | 232 if language is not None: |
231 extra[u'language'] = language | 233 extra[u'language'] = language |
232 email = kwargs.pop(u'email', None) | |
233 | 234 |
234 if email is not None: | 235 if email is not None: |
235 extra[u'email'] = email | 236 extra[u'email'] = email |
236 url_template = kwargs.pop(u'url_template', '') | 237 url_template = kwargs.pop(u'url_template', '') |
237 format_args = { | 238 format_args = { |