From 44b2371d5537d12b9bf0fa79157b4958c413c850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 13 Oct 2016 13:22:31 +0200 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(-) diff --git a/wcs/admin/forms.py b/wcs/admin/forms.py index 797e1a5..617017b 100644 --- a/wcs/admin/forms.py +++ b/wcs/admin/forms.py @@ -1178,7 +1178,7 @@ class FormDefPage(Directory): endpoints = [] for status in self.formdef.workflow.get_endpoint_status(): - endpoints.append((str(status.id), status.name)) + endpoints.append((str(status.id), status.name, str(status.id))) form = Form(enctype='multipart/form-data') form.add(DateWidget, 'before_request_date', diff --git a/wcs/admin/settings.py b/wcs/admin/settings.py index 21d72fe..30a0ca9 100644 --- a/wcs/admin/settings.py +++ b/wcs/admin/settings.py @@ -67,10 +67,10 @@ class IdentificationDirectory(Directory): get_response().breadcrumb.append( ('identification/', _('Identification')) ) identification_cfg = get_cfg('identification', {}) form = Form(enctype='multipart/form-data') - methods = [ ('password', _('Simple local username / password')), ] + methods = [ ('password', _('Simple local username / password'), 'password'), ] if lasso is not None: methods.insert(0, - ('idp', _('Delegated to SAML identity provider'))) + ('idp', _('Delegated to SAML identity provider'), 'idp')) form.add(CheckboxesWidget, 'methods', title = _('Methods'), value=identification_cfg.get('methods'), options=methods, diff --git a/wcs/qommon/form.py b/wcs/qommon/form.py index 23cecbe..86db7f1 100644 --- a/wcs/qommon/form.py +++ b/wcs/qommon/form.py @@ -1129,8 +1129,13 @@ class CheckboxesWidget(CompositeWidget): if self.options_with_attributes: options = self.options_with_attributes - for option in options: - key, title = option[:2] + for i, option in enumerate(options): + if len(option) == 2: + key, title = option[:2] + key = str(i) + else: + _, title, key = option[:3] + key = str(key) name = 'element%s' % key -- 2.9.3