    ===============
    Browser support
    ===============

    The ``pyams_form`` library provides a form framework and widgets. This document
    ensures that we implement a widget for each field defined in
    ``zope.schema``. Take a look at the different widget doctest files for more
    information about the widgets.

      >>> from pyramid.testing import setUp, tearDown
      >>> config = setUp(hook_zca=True)

      >>> from cornice import includeme as include_cornice
      >>> include_cornice(config)
      >>> from pyams_utils import includeme as include_utils
      >>> include_utils(config)
      >>> from pyams_site import includeme as include_site
      >>> include_site(config)
      >>> from pyams_i18n import includeme as include_i18n
      >>> include_i18n(config)
      >>> from pyams_form import includeme as include_form
      >>> include_form(config)

      >>> from pyams_form import util, testing
      >>> testing.setup_form_defaults(config.registry)

      >>> import zope.schema
      >>> from pyams_form import browser

    Also define a helper method for test the widgets:

      >>> from pyams_form import interfaces
      >>> from pyams_form.testing import TestRequest
      >>> def setupWidget(field):
      ...     request = TestRequest()
      ...     widget = zope.component.getMultiAdapter((field, request),
      ...         interfaces.widget.IFieldWidget)
      ...     widget.id = 'foo'
      ...     widget.name = 'bar'
      ...     return widget

      >>> from pyams_utils.testing import format_html

    ASCII
    -----

      >>> field = zope.schema.ASCII(default='This is\n ASCII.')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render())
    This is
       ASCII.
>>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) This is ASCII. Calling the widget will return the widget including the layout >>> print(widget())
This is ASCII.
As you can see, we will get an additional error class called ``row-error`` if we render a widget with an error view assigned: >>> class DummyErrorView(object): ... def render(self): ... return 'Dummy Error' >>> widget.error = (DummyErrorView()) >>> print(widget())
This is ASCII.
    ASCIILine
    ---------

      >>> field = zope.schema.ASCIILine(default='An ASCII line.')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) An ASCII line. Calling the widget will return the widget including the layout >>> print(widget())
An ASCII line.
    Bool
    ----

      >>> field = zope.schema.Bool(default=True, title="Check me")
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) yes no >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) yes Calling the widget will return the widget including the layout >>> print(widget())
Check me
yes
    For the boolean, the checkbox widget can be used as well:

      >>> from pyams_form.browser import checkbox
      >>> widget = checkbox.CheckBoxFieldWidget(field, TestRequest())
      >>> widget.id = 'foo'
      >>> widget.name = 'bar'
      >>> widget.update()

      >>> print(format_html(widget.render()))
yes no >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) yes Calling the widget will return the widget including the layout >>> print(widget())
Check me
yes
    We can also have a single checkbox button for the boolean.

      >>> widget = checkbox.SingleCheckBoxFieldWidget(field, TestRequest())
      >>> widget.id = 'foo'
      >>> widget.name = 'bar'
      >>> widget.update()

      >>> print(format_html(widget.render()))
Check me >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) Check me Note that the widget label is not repeated twice: >>> widget.label '' Calling the widget will return the widget including the layout >>> print(widget())
Check me
    Button
    ------

      >>> from pyams_form import button
      >>> field = button.Button(title='Press me!')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> print(format_html(widget.render())) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(format_html(widget.render()))
    There exists an alternative widget for the button field, the button widget. It
    is not used by default, but available for use:

      >>> from pyams_form.browser.button import ButtonFieldWidget
      >>> widget = ButtonFieldWidget(field, TestRequest())
      >>> widget.id = "foo"
      >>> widget.name = "bar"

      >>> widget.update()
      >>> print(format_html(widget.render()))
>>> widget.mode = interfaces.DISPLAY_MODE >>> print(format_html(widget.render()))
    Bytes
    -----

      >>> field = zope.schema.Bytes(default=b'Default bytes')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(format_html(widget.render())) Calling the widget will return the widget including the layout >>> print(widget())
    BytesLine
    ---------

      >>> field = zope.schema.BytesLine(default=b'A Bytes line.')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) A Bytes line. Calling the widget will return the widget including the layout >>> print(widget())
A Bytes line.
    Choice
    ------

      >>> from zope.schema import vocabulary
      >>> terms = [vocabulary.SimpleTerm(*value) for value in
      ...          [(True, 'yes', 'Yes'), (False, 'no', 'No')]]
      >>> vocabulary = vocabulary.SimpleVocabulary(terms)
      >>> field = zope.schema.Choice(default=True, vocabulary=vocabulary)
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render())
>>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) Yes Calling the widget will return the widget including the layout >>> print(widget())
Yes
    Date
    ----

      >>> import datetime
      >>> field = zope.schema.Date(default=datetime.date(2007, 4, 1))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) 4/1/07 Calling the widget will return the widget including the layout: >>> print(widget())
4/1/07
    Datetime
    --------

      >>> field = zope.schema.Datetime(default=datetime.datetime(2007, 4, 1, 12))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) 4/1/07 12:00 PM Calling the widget will return the widget including the layout >>> print(widget())
4/1/07 12:00 PM
    Decimal
    -------

      >>> import decimal
      >>> field = zope.schema.Decimal(default=decimal.Decimal('1265.87'))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) 1,265.87 Calling the widget will return the widget including the layout >>> print(widget())
1,265.87
    Dict
    ----

    There is no default widget for this field, since the sematics are fairly
    complex.

    DottedName
    ----------

      >>> field = zope.schema.DottedName(default='pyams_form')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) pyams_form Calling the widget will return the widget including the layout >>> print(widget())
pyams_form
    Float
    -----

      >>> field = zope.schema.Float(default=1265.8)
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) 1,265.8 Calling the widget will return the widget including the layout >>> print(widget())
1,265.8
    FrozenSet
    ---------

      >>> field = zope.schema.FrozenSet(
      ...     value_type=zope.schema.Choice(values=(1, 2, 3, 4)),
      ...     default=frozenset([1, 3]) )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
>>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) 1, 3 Calling the widget will return the widget including the layout >>> print(widget())
1, 3
    Id
    --

      >>> field = zope.schema.Id(default='pyams_form.id')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) pyams_form.id Calling the widget will return the widget including the layout >>> print(widget())
pyams_form.id
    ImageButton
    -----------

    Let's say we have a simple image field that uses the ``pressme.png`` image.

      >>> from pyams_form import button
      >>> field = button.ImageButton(
      ...     image='pressme.png',
      ...     title='Press me!')

      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render())
    Int
    ---

      >>> field = zope.schema.Int(default=1200)
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) 1,200
    List - ASCII
    ------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.ASCII(
      ...         title='ASCII',
      ...         default='This is\n ASCII.'),
      ...     default=['foo\nfoo', 'bar\nbar'])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
ASCII *
    foo
      foo
ASCII *
    bar
      bar
    List - ASCIILine
    ----------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.ASCIILine(
      ...         title='ASCIILine',
      ...         default='An ASCII line.'),
      ...     default=['foo', 'bar'])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
ASCIILine *
ASCIILine *
    List - Choice
    -------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Choice(values=(1, 2, 3, 4)),
      ...     default=[1, 3] )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))

>>> widget.mode = interfaces.DISPLAY_MODE >>> print(format_html(widget.render())) 1, 3
    List - Date
    -----------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Date(
      ...         title='Date',
      ...         default=datetime.date(2007, 4, 1)),
      ...     default=[datetime.date(2008, 9, 27), datetime.date(2008, 9, 28)])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Date *
Date *
    List - Datetime
    ---------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Datetime(
      ...         title='Datetime',
      ...         default=datetime.datetime(2007, 4, 1, 12)),
      ...     default=[datetime.datetime(2008, 9, 27, 12),
      ...              datetime.datetime(2008, 9, 28, 12)])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Datetime *
Datetime *
    List - Decimal
    ---------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Decimal(
      ...         title='Decimal',
      ...         default=decimal.Decimal('1265.87')),
      ...     default=[decimal.Decimal('123.456'), decimal.Decimal('1')])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Decimal *
Decimal *
    List - DottedName
    -----------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.DottedName(
      ...         title='DottedName',
      ...         default='pyams_form.id'),
      ...     default=['pyams_form.id', 'pyams.wizard'])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
DottedName *
DottedName *
    List - Float
    ------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Float(
      ...         title='Float',
      ...         default=123.456),
      ...     default=[1234.5, 1])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Float *
Float *
    List - Id
    ---------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Id(
      ...         title='Id',
      ...         default='pyams_form.id'),
      ...     default=['pyams_form.id', 'pyams.wizard'])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Id *
Id *
    List - Int
    ----------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Int(
      ...         title='Int',
      ...         default=666),
      ...     default=[42, 43])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Int *
Int *
    List - Password
    ---------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Password(
      ...         title='Password',
      ...         default='mypwd'),
      ...     default=['pwd', 'pass'])
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Password *
Password *
    List - SourceText
    -----------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.SourceText(
      ...         title='SourceText',
      ...         default='
'), ... default=['
foo
', '

# bar

    '] )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
SourceText *
    <html></body>foo</body></html>
SourceText *
    <h1>bar</h1>
    List - Text
    -----------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Text(
      ...         title='Text',
      ...         default='Some\n Text.'),
      ...     default=['foo\nfoo', 'bar\nbar'] )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Text *
    foo
      foo
Text *
    bar
      bar
    List - TextLine
    ---------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.TextLine(
      ...         title='TextLine',
      ...         default='Some Text line.'),
      ...     default=['foo', 'bar'] )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
TextLine *
TextLine *
    List - Time
    -----------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Time(
      ...         title='Time',
      ...         default=datetime.time(12, 0)),
      ...     default=[datetime.time(13, 0), datetime.time(14, 0)] )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Time *
Time *
    List - Timedelta
    ----------------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.Timedelta(
      ...         title='Timedelta',
      ...         default=datetime.timedelta(days=3)),
      ...     default=[datetime.timedelta(days=4), datetime.timedelta(days=5)] )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Timedelta *
Timedelta *
    List - URI
    ----------

      >>> field = zope.schema.List(
      ...     value_type=zope.schema.URI(
      ...         title='URI',
      ...         default='http://zope.org'),
      ...     default=['http://www.python.org', 'http://www.zope.com'] )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
URI *
URI *
    Object
    ------

    By default, we are not going to provide widgets for an object, since we
    believe this is better done using sub-forms.

    Password
    --------

      >>> field = zope.schema.Password(default='mypwd')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) mypwd
    Set
    ---

      >>> field = zope.schema.Set(
      ...     value_type=zope.schema.Choice(values=(1, 2, 3, 4)),
      ...     default=set([1, 3]) )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render())
>>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) 1, 3
    SourceText
    ----------

      >>> field = zope.schema.SourceText(default='
    ')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render())
    <source />
>>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) <source />
    Text
    ----

      >>> field = zope.schema.Text(default='Some\n Text.')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render())
    Some
       Text.
>>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) Some Text.
    TextLine
    --------

      >>> field = zope.schema.TextLine(default='Some Text line.')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) Some Text line.
    Time
    ----

      >>> field = zope.schema.Time(default=datetime.time(12, 0))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) 12:00 PM
    Timedelta
    ---------

      >>> field = zope.schema.Timedelta(default=datetime.timedelta(days=3))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) 3 days, 0:00:00
    Tuple - ASCII
    -------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.ASCII(
      ...         title='ASCII',
      ...         default='This is\n ASCII.'),
      ...     default=('foo\nfoo', 'bar\nbar'))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
ASCII *
    foo
      foo
ASCII *
    bar
      bar
    Tuple - ASCIILine
    -----------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.ASCIILine(
      ...         title='ASCIILine',
      ...         default='An ASCII line.'),
      ...     default=('foo', 'bar'))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
ASCIILine *
ASCIILine *
    Tuple - Choice
    --------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Choice(values=(1, 2, 3, 4)),
      ...     default=(1, 3) )
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))

>>> widget.mode = interfaces.DISPLAY_MODE >>> print(format_html(widget.render())) 1, 3
    Tuple - Date
    ------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Date(
      ...         title='Date',
      ...         default=datetime.date(2007, 4, 1)),
      ...     default=(datetime.date(2008, 9, 27), datetime.date(2008, 9, 28)))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Date *
Date *
    Tuple - Datetime
    ----------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Datetime(
      ...         title='Datetime',
      ...         default=datetime.datetime(2007, 4, 1, 12)),
      ...     default=(datetime.datetime(2008, 9, 27, 12),
      ...              datetime.datetime(2008, 9, 28, 12)))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Datetime *
Datetime *
    Tuple - Decimal
    ----------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Decimal(
      ...         title='Decimal',
      ...         default=decimal.Decimal('1265.87')),
      ...     default=(decimal.Decimal('123.456'), decimal.Decimal('1')))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Decimal *
Decimal *
    Tuple - DottedName
    ------------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.DottedName(
      ...         title='DottedName',
      ...         default='pyams_form.id'),
      ...     default=('pyams_form.id', 'pyams.wizard'))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
DottedName *
DottedName *
    Tuple - Float
    -------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Float(
      ...         title='Float',
      ...         default=123.456),
      ...     default=(1234.5, 1))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Float *
Float *
    Tuple - Id
    ----------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Id(
      ...         title='Id',
      ...         default='pyams_form.id'),
      ...     default=('pyams_form.id', 'pyams.wizard'))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Id *
Id *
    Tuple - Int
    -----------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Int(
      ...         title='Int',
      ...         default=666),
      ...     default=(42, 43))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Int *
Int *
    Tuple - Password
    ----------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Password(
      ...         title='Password',
      ...         default='mypwd'),
      ...     default=('pwd', 'pass'))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Password *
Password *
    Tuple - SourceText
    ------------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.SourceText(
      ...         title='SourceText',
      ...         default='
'), ... default=('
foo
', '

# bar

    '))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
SourceText *
    <html></body>foo</body></html>
SourceText *
    <h1>bar</h1>
    Tuple - Text
    ------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Text(
      ...         title='Text',
      ...         default='Some\n Text.'),
      ...     default=('foo\nfoo', 'bar\nbar'))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Text *
    foo
      foo
Text *
    bar
      bar
    Tuple - TextLine
    ----------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.TextLine(
      ...         title='TextLine',
      ...         default='Some Text line.'),
      ...     default=('foo', 'bar'))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
TextLine *
TextLine *
    Tuple - Time
    ------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Time(
      ...         title='Time',
      ...         default=datetime.time(12, 0)),
      ...     default=(datetime.time(13, 0), datetime.time(14, 0)))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Time *
Time *
    Tuple - Timedelta
    -----------------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.Timedelta(
      ...         title='Timedelta',
      ...         default=datetime.timedelta(days=3)),
      ...     default=(datetime.timedelta(days=4), datetime.timedelta(days=5)))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
Timedelta *
Timedelta *
    Tuple - URI
    -----------

      >>> field = zope.schema.Tuple(
      ...     value_type=zope.schema.URI(
      ...         title='URI',
      ...         default='http://zope.org'),
      ...     default=('http://www.python.org', 'http://www.zope.com'))
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(format_html(widget.render()))
URI *
URI *
    URI
    ---

      >>> field = zope.schema.URI(default='http://zope.org')
      >>> widget = setupWidget(field)
      >>> widget.update()

      >>> widget.__class__
>>> interfaces.IDataConverter(widget) >>> print(widget.render()) >>> widget.mode = interfaces.DISPLAY_MODE >>> print(widget.render()) http://zope.org Calling the widget will return the widget including the layout >>> print(widget())
http://zope.org
Tests cleanup: >>> tearDown()