本文整理匯總了Python中plone.app.widgets.dx.AjaxSelectWidget._base_args方法的典型用法代碼示例。如果您正苦於以下問題:Python AjaxSelectWidget._base_args方法的具體用法?Python AjaxSelectWidget._base_args怎麽用?Python AjaxSelectWidget._base_args使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類plone.app.widgets.dx.AjaxSelectWidget
的用法示例。
在下文中一共展示了AjaxSelectWidget._base_args方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_widget_addform_url_on_addform
# 需要導入模塊: from plone.app.widgets.dx import AjaxSelectWidget [as 別名]
# 或者: from plone.app.widgets.dx.AjaxSelectWidget import _base_args [as 別名]
def test_widget_addform_url_on_addform(self):
from plone.app.widgets.dx import AjaxSelectWidget
widget = AjaxSelectWidget(self.request)
form = Mock()
from zope.interface import directlyProvides
from z3c.form.interfaces import IAddForm
directlyProvides(form, IAddForm)
form.request = {'URL': 'http://addform_url'}
widget.form = form
self.assertEqual(
{
'name': None,
'value': u'',
'pattern': 'select2',
'pattern_options': {'separator': ';'},
},
widget._base_args(),
)
widget.vocabulary = 'vocabulary1'
self.assertEqual(
{
'name': None,
'value': u'',
'pattern': 'select2',
'pattern_options': {
'separator': ';',
'vocabularyUrl':
'http://addform_url/@@getVocabulary?name=vocabulary1'}
},
widget._base_args(),
)
示例2: test_widget
# 需要導入模塊: from plone.app.widgets.dx import AjaxSelectWidget [as 別名]
# 或者: from plone.app.widgets.dx.AjaxSelectWidget import _base_args [as 別名]
def test_widget(self):
from plone.app.widgets.dx import AjaxSelectWidget
widget = AjaxSelectWidget(self.request)
widget.update()
self.assertEqual(
{
'name': None,
'value': u'',
'pattern': 'select2',
'pattern_options': {'separator': ';'},
},
widget._base_args()
)
widget.vocabulary = 'example'
self.assertEqual(
widget._base_args(),
{
'name': None,
'value': u'',
'pattern': 'select2',
'pattern_options': {
'vocabularyUrl': '/@@getVocabulary?name=example',
'separator': ';'
},
}
)
widget.value = 'three;two'
self.assertEqual(
widget._base_args(),
{
'name': None,
'value': 'three;two',
'pattern': 'select2',
'pattern_options': {
'vocabularyUrl': '/@@getVocabulary?name=example',
'initialValues': {'three': u'Three', 'two': u'Two'},
'separator': ';'
},
}
)
示例3: test_widget_tuple_orderable
# 需要導入模塊: from plone.app.widgets.dx import AjaxSelectWidget [as 別名]
# 或者: from plone.app.widgets.dx.AjaxSelectWidget import _base_args [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(),
)
示例4: test_widget_set_not_orderable
# 需要導入模塊: from plone.app.widgets.dx import AjaxSelectWidget [as 別名]
# 或者: from plone.app.widgets.dx.AjaxSelectWidget import _base_args [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(),
)
示例5: test_widget_choice
# 需要導入模塊: from plone.app.widgets.dx import AjaxSelectWidget [as 別名]
# 或者: from plone.app.widgets.dx.AjaxSelectWidget import _base_args [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(),
)