Projet

Général

Profil

0001-forms-don-t-use-option-labels-as-element-names-in-ch.patch

Frédéric Péters, 13 octobre 2016 17:19

Télécharger (2,5 ko)

Voir les différences:

Subject: [PATCH] forms: don't use option labels as element names in checkboxes
 widget (#13581)

 wcs/admin/forms.py    | 2 +-
 wcs/admin/settings.py | 4 ++--
 wcs/qommon/form.py    | 9 +++++++--
 3 files changed, 10 insertions(+), 5 deletions(-)
wcs/admin/forms.py
1178 1178

  
1179 1179
        endpoints = []
1180 1180
        for status in self.formdef.workflow.get_endpoint_status():
1181
            endpoints.append((str(status.id), status.name))
1181
            endpoints.append((str(status.id), status.name, str(status.id)))
1182 1182

  
1183 1183
        form = Form(enctype='multipart/form-data')
1184 1184
        form.add(DateWidget, 'before_request_date',
wcs/admin/settings.py
67 67
        get_response().breadcrumb.append( ('identification/', _('Identification')) )
68 68
        identification_cfg = get_cfg('identification', {})
69 69
        form = Form(enctype='multipart/form-data')
70
        methods = [ ('password', _('Simple local username / password')), ]
70
        methods = [ ('password', _('Simple local username / password'), 'password'), ]
71 71
        if lasso is not None:
72 72
            methods.insert(0,
73
                    ('idp', _('Delegated to SAML identity provider')))
73
                    ('idp', _('Delegated to SAML identity provider'), 'idp'))
74 74
        form.add(CheckboxesWidget, 'methods', title = _('Methods'),
75 75
                value=identification_cfg.get('methods'),
76 76
                options=methods,
wcs/qommon/form.py
1129 1129
        if self.options_with_attributes:
1130 1130
            options = self.options_with_attributes
1131 1131

  
1132
        for option in options:
1133
            key, title = option[:2]
1132
        for i, option in enumerate(options):
1133
            if len(option) == 2:
1134
                key, title = option[:2]
1135
                key = str(i)
1136
            else:
1137
                _, title, key  = option[:3]
1138

  
1134 1139
            key = str(key)
1135 1140
            name = 'element%s' % key
1136 1141

  
1137
-