當前位置: 首頁>>代碼示例>>Python>>正文


Python DefaultAddForm.update方法代碼示例

本文整理匯總了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]))
開發者ID:plone,項目名稱:plone.dexterity,代碼行數:34,代碼來源:test_views.py

示例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")
開發者ID:plone,項目名稱:plone.dexterity,代碼行數:32,代碼來源:test_views.py

示例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()
開發者ID:chaoflow,項目名稱:plone.dexterity,代碼行數:33,代碼來源:test_views.py

示例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)
開發者ID:mingtak,項目名稱:learn.teacher,代碼行數:4,代碼來源:defaultForms.py


注:本文中的plone.dexterity.browser.add.DefaultAddForm.update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。