Ajout fonction utilitaire pour encoder de manière sécurisé les en-tête des mails.
[Plinn.git] / skins / control / topic_edit_criteria_control.py
1 ##parameters=criteria, **kw
2
3 """\
4 Save changes to the list of criteria. This is done by going over
5 the submitted criteria records and comparing them against the
6 criteria object's editable attributes. A 'command' object is
7 built to send to the Criterion objects 'apply' method, which in turn
8 applies the command to the Criterion objects 'edit' method.
9 """
10
11 for rec in criteria:
12 crit = context.getCriterion(rec.id)
13 command = {}
14 for attr in crit.editableAttributes():
15 tmp = getattr(rec, attr, None)
16 # Due to having multiple radio buttons on the same page
17 # with the same name but belonging to different records,
18 # they needed to be associated with different records with ids
19 if tmp is None:
20 tmp = getattr(rec, '%s__%s' % (attr, rec.id), None)
21 command[attr] = tmp
22 crit.apply(command)
23
24 if kw.has_key('acquireCriteria') :
25 context.edit(kw['acquireCriteria'])
26
27 return context.setStatus(True, "Changes saved.")