Esempio n. 1
0
 def compoundChecker(theAnswer=CompoundChecker(
     [formless.Integer(label="six"),
      formless.Integer(label="nine")],
     label="The Answer",
     description="What is the meaning of life, the universe, and everything?"
 )):
     """The Answer
     
     Please type the integer six in the first box, and nine in the second.
     """
     return formless.Object(label="The Answer", interface=formless.Integer)
Esempio n. 2
0
 def testInteger(self):
     i = formless.Integer(required=True)
     self.assertEqual(process(i, "0"), 0)
     self.assertEqual(process(i, "3409823098"), 3409823098)
     self.assertRaises(formless.InputError, process, i, "")
     self.assertRaises(formless.InputError, process, i, "a string")
     self.assertRaises(formless.InputError, process, i, "1.5")
     
     i = formless.Integer(required=False)
     self.assertEqual(process(i, "1234567"), 1234567)
     self.assertEqual(process(i, ""), None)
Esempio n. 3
0
            class Inner(formless.TypedInterface):
                one = formless.Integer()
                two = formless.Integer()

                def buckleMyShoe():
                    pass
                buckleMyShoe = formless.autocallable(buckleMyShoe)

                def buriedAlive():
                    pass
                buriedAlive = formless.autocallable(buriedAlive)
Esempio n. 4
0
        class ISimpleTypedInterface(formless.TypedInterface):
            anInt = formless.Integer()

            def aMethod(aString=formless.String()):
                return None

            aMethod = formless.autocallable(aMethod)
Esempio n. 5
0
 def someMethod(one=formless.Object(interface=IBar),
                two=formless.Integer(description="an integer please")):
     """Some Method.
     
     This method takes an IBar instance.
     """
     return None
Esempio n. 6
0
 def compoundTest(aCompound=formless.Compound([
     formless.String(label="firstname"),
     formless.String(label="lastname")
 ],
                                              label="Full Name"),
                  anInt=formless.Integer()):
     """Compound Test
     
     A test of a widget/controller which renders multiple fields, triggers multiple
     validators, but gathers the result into one method argument. There can
     be an additional validation step which validates that the compound data
     as a whole is valid.
     """
     return str
Esempio n. 7
0
    def test_1_renderWithDefaultValues(self):
        binding = formless.MethodBinding('haveFun', formless.Method(
            returnValue=None,
            arguments=[formless.Argument('funValue', formless.Integer(label="Fun Value", default=0))]
        ))

        def setupCtx(ctx):
            ctx.locate(iformless.IFormDefaults).setDefault('funValue', 15)
            return ctx

        renderer = iformless.IBindingRenderer(binding)
        def later(val):
            self.failIfSubstring('0', val)
            self.assertSubstring('15', val)
        return self.render(tags.invisible(data=binding, render=renderer), setupContext=setupCtx).addCallback(
            later)
Esempio n. 8
0
 class IThing(formless.TypedInterface):
     foo = formless.Integer()
Esempio n. 9
0
 class IAProperty(formless.TypedInterface):
     prop = formless.Integer()
Esempio n. 10
0
 def password(pword=formless.Password(),
              integer=formless.Integer()):
     pass
Esempio n. 11
0
 class IDefaultProperty(formless.TypedInterface):
     default = formless.Integer(default=2)
Esempio n. 12
0
class IFrob(formless.TypedInterface):
    integer = formless.Integer()
Esempio n. 13
0
 class Inner(formless.TypedInterface):
     """Docstring
     
     This is a docstring.
     """
     anInnerProperty = formless.Integer()
Esempio n. 14
0
 def bar(barbaz=formless.Integer(label="The Baz")):
     ## this has no docstring, make sure it doesn't fail
     return formless.String()
Esempio n. 15
0
 class Test(formless.TypedInterface):
     foo = formless.String()
     bar = formless.Text()
     baz = formless.Integer()
     quux = formless.Object(interface=_indirectOther())