plugin invitations: on modify an empty value delete corresponding extra keys, and reserved keys are now ignored.
This commit is contained in:
parent
48100ac776
commit
97c3333418
1 changed files with 11 additions and 1 deletions
|
|
@ -294,6 +294,7 @@ class InvitationsPlugin(object):
|
||||||
|
|
||||||
@param id_(unicode): UUID linked to an invitation
|
@param id_(unicode): UUID linked to an invitation
|
||||||
@param new_extra(dict[unicode, unicode]): data to update
|
@param new_extra(dict[unicode, unicode]): data to update
|
||||||
|
empty values will be deleted if replace is True
|
||||||
@param replace(bool): if True replace the data
|
@param replace(bool): if True replace the data
|
||||||
else update them
|
else update them
|
||||||
@raise KeyError: there is not invitation with this id_
|
@raise KeyError: there is not invitation with this id_
|
||||||
|
|
@ -310,7 +311,16 @@ class InvitationsPlugin(object):
|
||||||
else:
|
else:
|
||||||
new_data = current_data
|
new_data = current_data
|
||||||
for k,v in new_extra.iteritems():
|
for k,v in new_extra.iteritems():
|
||||||
new_data[k] = v
|
if k in EXTRA_RESERVED:
|
||||||
|
log.warning(_(u"Skipping reserved key {key}".format(k)))
|
||||||
|
continue
|
||||||
|
if v:
|
||||||
|
new_data[k] = v
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
del new_data[k]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
self.invitations[id_] = new_data
|
self.invitations[id_] = new_data
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue