本文整理匯總了Python中plone.dexterity.browser.add.DefaultAddForm.update方法的典型用法代碼示例。如果您正苦於以下問題:Python DefaultAddForm.update方法的具體用法?Python DefaultAddForm.update怎麽用?Python DefaultAddForm.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類plone.dexterity.browser.add.DefaultAddForm
的用法示例。
在下文中一共展示了DefaultAddForm.update方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_fires_add_begun_event
# 需要導入模塊: from plone.dexterity.browser.add import DefaultAddForm [as 別名]
# 或者: from plone.dexterity.browser.add.DefaultAddForm import update [as 別名]
def test_fires_add_begun_event(self):
# Context and request
context_mock = self.create_dummy(
portal_type=u'testtype',
allowedContentTypes=lambda: [self.create_dummy(getId=lambda: 'testtype')])
request_mock = TestRequest()
# FTI
fti_mock = DexterityFTI(u"testtype")
fti_mock.lookupSchema = Mock(return_value=ISchema)
self.mock_utility(fti_mock, IDexterityFTI, name=u"testtype")
self.mock_adapter(
FieldWidgets,
IWidgets,
(Interface, Interface, Interface)
)
self.mock_adapter(Actions, IActions, (Interface, Interface, Interface))
# mock notify
from zope.event import notify
notify_mock = self.patch_global(notify)
# Form
view = DefaultAddForm(context_mock, request_mock)
view.portal_type = fti_mock.getId()
view.update()
self.assertTrue(notify_mock.called)
self.assertTrue(IAddBegunEvent.providedBy(notify_mock.call_args[0][0]))
示例2: test_update_ignores_type_check_if_security_check_deferred
# 需要導入模塊: from plone.dexterity.browser.add import DefaultAddForm [as 別名]
# 或者: from plone.dexterity.browser.add.DefaultAddForm import update [as 別名]
def test_update_ignores_type_check_if_security_check_deferred(self):
# Context and request
context_mock = self.create_dummy(
portal_type=u'testtype',
allowedContentTypes=lambda: [])
request_mock = TestRequest()
alsoProvides(request_mock, IDeferSecurityCheck)
# FTI
fti_mock = DexterityFTI(u"testtype")
fti_mock.lookupSchema = Mock(return_value=ISchema)
self.mock_utility(fti_mock, IDexterityFTI, name=u"testtype")
self.mock_adapter(
FieldWidgets,
IWidgets,
(Interface, Interface, Interface)
)
self.mock_adapter(Actions, IActions, (Interface, Interface, Interface))
# Form
view = DefaultAddForm(context_mock, request_mock)
view.portal_type = fti_mock.getId()
try:
view.update()
except ValueError:
self.fail("Update raised Unauthorized with security checks "
"deferred")
示例3: test_fires_add_begun_event
# 需要導入模塊: from plone.dexterity.browser.add import DefaultAddForm [as 別名]
# 或者: from plone.dexterity.browser.add.DefaultAddForm import update [as 別名]
def test_fires_add_begun_event(self):
# Context and request
context_mock = self.create_dummy(portal_type=u'testtype')
request_mock = TestRequest()
# FTI
fti_mock = self.mocker.proxy(DexterityFTI(u"testtype"))
self.expect(fti_mock.lookupSchema()).result(ISchema)
self.mocker.count(0, 100)
self.mock_utility(fti_mock, IDexterityFTI, name=u"testtype")
self.mock_adapter(FieldWidgets, IWidgets, (Interface, Interface, Interface))
self.mock_adapter(Actions, IActions, (Interface, Interface, Interface))
# mock notify
notify_mock = self.mocker.replace('zope.event.notify')
self.expect(notify_mock(mocker.MATCH(
lambda x: IAddBegunEvent.providedBy(x)
)))
# Form
self.replay()
view = DefaultAddForm(context_mock, request_mock)
view.portal_type = fti_mock.getId()
view.update()
示例4: update
# 需要導入模塊: from plone.dexterity.browser.add import DefaultAddForm [as 別名]
# 或者: from plone.dexterity.browser.add.DefaultAddForm import update [as 別名]
def update(self):
DefaultAddForm.update(self)