本文整理汇总了Python中plone.app.widgets.dx.AjaxSelectWidget.field方法的典型用法代码示例。如果您正苦于以下问题:Python AjaxSelectWidget.field方法的具体用法?Python AjaxSelectWidget.field怎么用?Python AjaxSelectWidget.field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.app.widgets.dx.AjaxSelectWidget
的用法示例。
在下文中一共展示了AjaxSelectWidget.field方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_data_converter_tuple
# 需要导入模块: from plone.app.widgets.dx import AjaxSelectWidget [as 别名]
# 或者: from plone.app.widgets.dx.AjaxSelectWidget import field [as 别名]
def test_data_converter_tuple(self):
from plone.app.widgets.dx import AjaxSelectWidget
from plone.app.widgets.dx import AjaxSelectWidgetConverter
field = Tuple(__name__='tuplefield', value_type=TextLine())
widget = AjaxSelectWidget(self.request)
widget.field = field
converter = AjaxSelectWidgetConverter(field, widget)
self.assertEqual(
converter.toFieldValue(''),
field.missing_value,
)
self.assertEqual(
converter.toFieldValue('123;456;789'),
('123', '456', '789'),
)
self.assertEqual(
converter.toWidgetValue(tuple()),
None,
)
self.assertEqual(
converter.toWidgetValue(('123', '456', '789')),
'123;456;789',
)
示例2: test_widget_tuple_orderable
# 需要导入模块: from plone.app.widgets.dx import AjaxSelectWidget [as 别名]
# 或者: from plone.app.widgets.dx.AjaxSelectWidget import field [as 别名]
def test_widget_tuple_orderable(self):
from plone.app.widgets.dx import AjaxSelectWidget
widget = AjaxSelectWidget(self.request)
widget.field = Tuple(__name__='selectfield')
self.assertEqual(
{
'name': None,
'value': u'',
'pattern': 'select2',
'pattern_options': {'orderable': True, 'separator': ';'},
},
widget._base_args(),
)
示例3: test_widget_set_not_orderable
# 需要导入模块: from plone.app.widgets.dx import AjaxSelectWidget [as 别名]
# 或者: from plone.app.widgets.dx.AjaxSelectWidget import field [as 别名]
def test_widget_set_not_orderable(self):
from plone.app.widgets.dx import AjaxSelectWidget
widget = AjaxSelectWidget(self.request)
# A set is not orderable
widget.field = Set(__name__='selectfield')
self.assertEqual(
{
'name': None,
'value': None,
'pattern': 'select2',
'pattern_options': {'separator': ';'},
},
widget._base_args(),
)
示例4: test_widget_choice
# 需要导入模块: from plone.app.widgets.dx import AjaxSelectWidget [as 别名]
# 或者: from plone.app.widgets.dx.AjaxSelectWidget import field [as 别名]
def test_widget_choice(self):
from plone.app.widgets.dx import AjaxSelectWidget
from zope.schema.interfaces import ISource
widget = AjaxSelectWidget(self.request)
source = Mock()
alsoProvides(source, ISource)
widget.field = Choice(__name__='choicefield', source=source)
widget.name = 'choicefield'
self.assertEqual(
{
'name': 'choicefield',
'value': u'',
'pattern': 'select2',
'pattern_options': {
'separator': ';',
'maximumSelectionSize': 1,
'vocabularyUrl':
'http://127.0.0.1/++widget++choicefield/@@getSource',
},
},
widget._base_args(),
)