Skip to main content

This package allows to work around problems/weaknesses in zope.formlib and the associated widgets in zope.app.form.browser, described by “https://bugs.launchpad.net/zope3/+bug/528920” and “https://bugs.launchpad.net/zope3/+bug/528912”.

The package has been developed for Zope 2.10, will probably work for Zope 2.11 and is unlikely to work for very new Zope versions, because the widget code has been moved from zope.app.form to zope.formlib. I may publish versions of this package for new Zope versions in the future.

The package consists of various modules described below.

To use the package in your application, you import some of its patch functions (mentioned below) and call them during the startup of your application.

I hope that corresponding patches will sooner or later appear in the standard Zope code and make this package obsolete.

form

Together with widget, this module is destined to work around http://dev.plone.org/plone/ticket/10264 and https://bugs.launchpad.net/zope3/+bug/528920.

zope.formlib distinguishes between widget related errors and other (more global) errors. If a widget itself detects a widget related error (usually because a restriction for the associated field fails), it sets its error condition. This error condition is usually used to highlight the widget containing an error and to provide information about this error. However, if the widget related error is not detected by the widget itself, the error is not associated with the widget and important information may be missing.

The function patch_action() in module form enhances zope.formlib.form.Action by an additional method associate_errors_with_widgets and redefines its failure method to call it unless an explicit failure handler is specified. This provides for automatic error association with the widgets in the standard case.

associate_errors_with_widgets tries to associate zope.app.form.interfaces.WidgetInputError with the corresponding widget. For this purpose, the widget must have a setWidgetInputError method. By default widgets lack this method. However widget.patch_widget() can be used to define it. Therefore, form.patch_action() and widget.patch_widget() are usually used together.

widget

Together with form, this module is destined to work around http://dev.plone.org/plone/ticket/10264 and https://bugs.launchpad.net/zope3/+bug/528920.

Its patch_widget() enhances zope.app.form.browser.widget.BrowserWidget (the base class for zope.app.form widgets) by defining the method setWidgetInputError. The method allows external code to set an error condition on the widget.

setWidgetInputError is used by the error handling implemented by the form module. Therefore, widget.patch_widget() is usually used together with form.patch_action().

multiselection

This module is destined to work around http://dev.plone.org/plone/ticket/10267 and https://bugs.launchpad.net/zope3/+bug/528912.

Its patch_OrderedMultiSelectWidget() fixes zope.app.form.browser.itemswidgets.OrderedMultiSelectWidget.

Version history

2.0

Python 3 compatibility

Metadata

Release files for dm.zopepatches.formlib 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dm.zopepatches.formlib 2.0
File Size Uploaded
dm.zopepatches.formlib-2.0.tar.gz 4.7 kB Details

Release files / dm.zopepatches.formlib-2.0.tar.gz

Download URL dm.zopepatches.formlib-2.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
250a45501d9d6021ade4adbb592fdf51a3c886a3e159703f92a46aa3458ed9d8
BLAKE2b-256 checksum
How to use checksums
5d8b079dc2b948ba3167ea900ff32c7744f2485e27ccaee0e70ce36f7ef291a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Release history Release notifications | RSS feed

This release

2.0 This release

1 release file

1.0.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page