# HG changeset patch # User Thierry Florac # Date 1564148398 -7200 # Node ID d5f2be8c16ad3bd78aef8f7caeaf513a5aa42c3c # Parent df3f13ea95cc3adf6d3168dc46b18b6e055f704a Renamed form input class diff -r df3f13ea95cc -r d5f2be8c16ad src/pyams_default_theme/shared/form/__init__.py --- a/src/pyams_default_theme/shared/form/__init__.py Fri Jul 26 13:13:44 2019 +0200 +++ b/src/pyams_default_theme/shared/form/__init__.py Fri Jul 26 15:39:58 2019 +0200 @@ -45,7 +45,7 @@ RECAPTCHA_FIELD_NAME = 'g-recaptcha-response' -class FormFieldContainerDisplayForm(AddForm): +class FormFieldContainerInputForm(AddForm): """Form fields container display form""" @property @@ -78,13 +78,13 @@ return field.Fields(*tuple(get_fields())) def updateActions(self): - super(FormFieldContainerDisplayForm, self).updateActions() + super(FormFieldContainerInputForm, self).updateActions() if 'submit' in self.actions: self.actions['submit'].title = II18n(self.context).query_attribute('submit_label', request=self.request) def updateWidgets(self, prefix=None): - super(FormFieldContainerDisplayForm, self).updateWidgets(prefix) + super(FormFieldContainerInputForm, self).updateWidgets(prefix) for widget in self.widgets.values(): if widget.field.__name__ == CSRF_FIELD_NAME: widget.name = CSRF_FIELD_NAME @@ -107,6 +107,7 @@ if errors: self.status = self.formErrorsMessage else: + # remove custom data fields from handler data if CSRF_FIELD_NAME in data: del data[CSRF_FIELD_NAME] if self.context.use_captcha: @@ -129,7 +130,7 @@ handler.handle(form, data) -@adapter_config(context=(IFormFieldContainerTarget, IPyAMSLayer, FormFieldContainerDisplayForm), +@adapter_config(context=(IFormFieldContainerTarget, IPyAMSLayer, FormFieldContainerInputForm), provides=IFormHelp) class FormFieldContainerDisplayFormHelp(FormHelp): """Form field container display form help adapter""" @@ -147,7 +148,7 @@ @viewlet_config(name='recaptcha', context=IFormFieldContainerTarget, layer=IPyAMSDefaultLayer, - view=FormFieldContainerDisplayForm, manager=IFormSuffixViewletsManager) + view=FormFieldContainerInputForm, manager=IFormSuffixViewletsManager) @template_config(template='templates/recaptcha.pt', layer=IPyAMSDefaultLayer) class FormCaptchaViewlet(Viewlet): """Form captcha viewlet""" @@ -168,7 +169,7 @@ def __init__(self, context, request): super(FormFieldContainerRenderer, self).__init__(context, request) - self.input_form = FormFieldContainerDisplayForm(context, self.request) + self.input_form = FormFieldContainerInputForm(context, self.request) def update(self): super(FormFieldContainerRenderer, self).update() @@ -186,7 +187,7 @@ def __init__(self, context, request): super(FormSubmitPage, self).__init__(context, request) - self.input_form = FormFieldContainerDisplayForm(context, self.request) + self.input_form = FormFieldContainerInputForm(context, self.request) def update(self): super(FormSubmitPage, self).update()