Exemplo n.º 1
0
 def test_html3(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"
     form.subsets = {
         u"test": {
             "fields": [
                 u"ftext",
                 FieldConf(
                     **{
                         "id": "section1",
                         "name": "Section 1",
                         "datatype": "number"
                     })
             ]
         }
     }
     form.Setup(subset=u"test")
     v, d, e = form.Validate(data1_2)
     self.assert_(v, e)
     form.Render(d, msgs=None, errors=None)
Exemplo n.º 2
0
 def test_html2(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"
     form.subsets = {u"test": {"fields": [u"ftext", u"funit"]}}
     form.Setup(subset=u"test")
     v, d, e = form.Validate(data1_2)
     self.assert_(v, e)
     form.Render(d, msgs=None, errors=None)
Exemplo n.º 3
0
    def test_html(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"
        form.Setup()

        v, d, e = form.Validate(data1_1)
        self.assert_(v, str(e))

        v, d, e = form.Validate(data1_2)
        self.assertFalse(v, e)
        form.Render(d, msgs=None, errors=None)

        result, data = form.Extract(data1_1)
        self.assert_(data)
        result, data = form.Extract(data1_2)
        self.assert_(data)