API reference¶
Here you can see the technical documentation.
-
class
pypom_form.widgets.
BaseWidgetRegion
(page, root=None)[source]¶ This is the base widget region associated to a widget.
You can lookup the base widget region from a page or region form with
page.getWidgetRegion('field_name')
in order to enable advanced widget interactions.For example you can get the field label, the help text, validation errors or if you have a complex widget you can expose the widget API. For example a multi selection widget with a filter feature or a reference field with a navigation popup with all the portal contents.
This way you are not only able to set or get field values but you can incapsulate complex logics in the widget region and expose them on the page or region form ready to be used
-
class
pypom_form.widgets.
BaseWidget
(field=None, region_class=None, options={})[source]¶ This is the base widget. It is not intended to be used itself but you can use it as base class for your own widgets.
You can associate widgets on schema level or the form metaclass will associate a fallback depending on the schema type if
pypom_widget
is missing.You can provide your own
region_class
on the schema definition of overriding theregion_class
class attribute in your own widget implementations.-
region_class
¶ alias of
BaseWidgetRegion
-
input_selector
¶ Returns the input selector inside the field container.
Most or times is a tuple with
('tag', 'input')
but it might change depending on the widget type.It’s up to you providing the input selector that matches your input type.
-
get_input_element
(page)[source]¶ Return the input element.
If you provide a selector for the container of the input element, it will return the input element itself (preferred way if you want to use advanced widget features).
Otherwise the region root will be returned
-
getWidgetRegion
(page)[source]¶ Returns a dynamic widget region containing the root selector.
This is an internal method used by the page or region metaclass in order to be able to expose the widget region simply calling
page.getWidgetRegion()
.It also sets a reference to the widget itself containing the widget options on the widget region.
-
getter_factory
()[source]¶ Returns a generated method to be attached on the PyPOM page or region.
This is an internal method used by the page or region metaclass in order to be able to generate the getter method for the field.
-
setter_factory
()[source]¶ Returns a generated method to be attached on the PyPOM page or region.
This is an internal method used by the page or region metaclass in order to be able to generate the getter method for the field.
-
-
class
pypom_form.widgets.
StringWidget
(field=None, region_class=None, options={})[source]¶ String widget