コード例 #1
0
    def test_fields(self, **kw):
        form = HTMLForm(loadFromType="type1",
                        app=self.app,
                        view=self.view,
                        request=Request())
        form.formUrl = "form/url"
        form.cssID = u"upload"
        form.css_class = u"niveform"
        # create
        form.Setup()

        f = form.GetFields(removeReadonly=True)
        self.assert_(len(f) == 9)
        f = form.GetFields(removeReadonly=False)
        self.assert_(len(f) == 14)
コード例 #2
0
 def test_form(self, **kw):
     form = HTMLForm(loadFromType="type1",
                     context=None,
                     request=Request(),
                     app=self.app,
                     view=self.view)
     form.Setup()
     self.assert_(form.GetFields())
     form._SetUpSchema()
     self.assertFalse(form.GetField("test000"))
     request = Request()
     form.LoadDefaultData()
     form.GetActions(True)
     form.GetActions(False)
     form.GetFormValue("test", request=request, method=None)
     form.GetFormValues(request)
     form.StartForm("action", defaultData={"a": 1})
     form.StartForm("action")
     form.StartRequestGET("action")
     form.StartRequestPOST("action")
     form.Cancel("action")