Skip to content

Commit

Permalink
whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
strichter committed Mar 25, 2009
1 parent 3444913 commit 01182f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
17 changes: 8 additions & 9 deletions src/z3c/form/browser/object.txt
Expand Up @@ -2,12 +2,12 @@
ObjectWidget
============

The ObjectWidget is about rendering a schema's fields as a single widget.
The `ObjectWidget` widget is about rendering a schema's fields as a single
widget.


There are way too many preconditions to exercise the ObjectWidget as it
relies heavily on the from and widget framework.
It renders the sub-widgets in a sub-form.
There are way too many preconditions to exercise the `ObjectWidget` as it
relies heavily on the from and widget framework. It renders the sub-widgets in
a sub-form.

In order to not overwhelm you with our set of well-chosen defaults,
all the default component registrations have been made prior to doing those
Expand All @@ -34,9 +34,7 @@ examples:
>>> from z3c.form.error import MultipleErrorViewSnippet
>>> zope.component.provideAdapter(MultipleErrorViewSnippet)



As for all widgets, the objectwidget must provide the new ``IWidget``
As for all widgets, the objectwidget must provide the new `IWidget`
interface:

>>> from zope.interface.verify import verifyClass
Expand Down Expand Up @@ -66,7 +64,8 @@ There is no life for ObjectWidget without a schema to render:
>>> widget.update()
Traceback (most recent call last):
...
ValueError: <ObjectWidget 'widget.name'> .field is None, that's a blocking point
ValueError: <ObjectWidget 'widget.name'> .field is None,
that's a blocking point

This schema is specified by the field:

Expand Down
26 changes: 13 additions & 13 deletions src/z3c/form/widget.txt
Expand Up @@ -515,14 +515,14 @@ Multi Widget
------------

A common use case in user interfaces is to ask the user to define one or more
items. The ``widget`` module provides a basic widget implementation to support
items. The ``widget`` module provides a basic widget implementation to support
this use case.

The MultiWidget allows to store none, one or more values for a sequence field.
Don't get cinfused by the term sequence. Ther sequence used in SequenceWidget
means that the widget can choose from a sequence of values which is a really
a collection. The MultiWidget can collect values for build and store a
sequence of values like used in ITuple or IList field.
The `MultiWidget` allows to store none, one or more values for a sequence
field. Don't get cinfused by the term sequence. Ther sequence used in
`SequenceWidget` means that the widget can choose from a sequence of values
which is a really a collection. The `MultiWidget` can collect values for build
and store a sequence of values like used in `ITuple` or `IList` field.

>>> request = TestRequest()
>>> multiWidget = widget.MultiWidget(request)
Expand All @@ -538,7 +538,7 @@ Let's define a field for our multi widget:
... value_type=zope.schema.Int(default=42))
>>> multiWidget.field = multiField

The value of a multi widget is always list. When extracting values from the
The value of a multi widget is always list. When extracting values from the
request, the values must be a list of valid values based on the value_type
field used from the used sequence field. The widget also uses a counter which
is required for processing the input from a request. The counter is a marker
Expand Down Expand Up @@ -573,14 +573,14 @@ Our widget update process will validate this bad value later:
>>> multiWidget.extract()
[u'bad']

Storing a widget value forces to update the (sub) widgets. this forces also to
validate the (sub) widget values. For showing this we nee dot register a
Storing a widget value forces to update the (sub) widgets. this forces also to
validate the (sub) widget values. For showing this we nee dot register a
validator:

>>> from z3c.form.validator import SimpleFieldValidator
>>> zope.component.provideAdapter(SimpleFieldValidator)

Since the value of the widget is a list of (widget) value items, when
Since the value of the widget is a list of (widget) value items, when
displaying the values, they can be used as they are:

>>> multiWidget.request = TestRequest(form={'multi.name.count':'2',
Expand All @@ -590,9 +590,9 @@ displaying the values, they can be used as they are:
>>> multiWidget.value
[u'42', u'43']

Each widget normaly gets first process by it's update method call after
Each widget normaly gets first process by it's update method call after
intialization. This update call forces to call extract, which first will get
the right amount of (sub) widgets by the given counter value. Based on that
the right amount of (sub) widgets by the given counter value. Based on that
counter value the right amount of widgets will get created. Each widget will
return it's own value and this collected values get returned by the extract
method. The multi widget update method will then store this values if any give
Expand All @@ -602,7 +602,7 @@ from the extract as multi widget value, this will force to setup the multi
widget widgets based on the given values and apply the right value for them.
After that the mutli widget is ready for rendering. The good thing about that
pattern is that it is possible to set a value before or after the update method
is called. At any time if we change the mutli widget value the (sub) widgets
is called. At any time if we change the mutli widget value the (sub) widgets
get updated within the new relevant value.

>>> multiRequest = TestRequest(form={'multi.name.count':'2',
Expand Down

0 comments on commit 01182f3

Please sign in to comment.