Пример #1
0
 class IDynamicDefaults(formless.TypedInterface):
     def aMethod(foo=formless.String(default="NOTFOO")):
         pass
     def bMethod(foo=formless.String(default="NOTBAR")):
         pass
     aMethod = formless.autocallable(aMethod)
     bMethod = formless.autocallable(bMethod)
Пример #2
0
        class Test(formless.TypedInterface):
            def noArgs(self):
                pass
            noArgs = formless.autocallable(noArgs)

            def oneArg(self, someParam=formless.String()):
                pass
            oneArg = formless.autocallable(oneArg)
Пример #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)
Пример #4
0
        class ISimpleTypedInterface(formless.TypedInterface):
            anInt = formless.Integer()

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

            aMethod = formless.autocallable(aMethod)
Пример #5
0
        class IBindingDefaults(formless.TypedInterface):
            def aMethod(foo=formless.String(default="The foo")):
                pass

            aMethod = formless.autocallable(aMethod)

            aProperty = formless.String(default="The property")
Пример #6
0
        class Test2(formless.TypedInterface):
            def foo(foobar=formless.String()):
                """This is a description of foo"""
                pass
            foo = formless.autocallable(foo)

            def bar(barbaz=formless.Integer(label="The Baz")):
                ## this has no docstring, make sure it doesn't fail
                return formless.String()
            bar = formless.autocallable(bar, someAttribute="Hello")

            def baz(bazfoo=formless.Boolean(label="The Foo", description="The foo to baz.")):
                """The Label

                The description"""
                return IFoo
            baz = formless.autocallable(baz)
Пример #7
0
 class Test(formless.TypedInterface):
     def foo(foobar=formless.String()):
         """
         Label for foo
         Description for foo
         """
         pass
     foo = formless.autocallable(foo, action="Do something!")
Пример #8
0
        class ITest(formless.TypedInterface):
            """Test that a property value on one form does not 'leak' into
            a property of the same name on another form.
            """
            foo = formless.String()

            def meth(foo = formless.String()):
                pass
            meth = formless.autocallable(meth)
Пример #9
0
class IObjectTest(formless.TypedInterface):
    def someMethod(one=formless.Object(interface=IBar),
                   two=formless.Integer(description="an integer please")):
        """Some Method.
        
        This method takes an IBar instance.
        """
        return None

    someMethod = formless.autocallable(someMethod)

    def frobber(frobber=formless.Object(interface=IFrob),
                frobee=formless.Object(IFrob)):
        """Frobber.
        
        Takes two frobs and raises one to the power of the other.
        """
        return IFrob

    frobber = formless.autocallable(frobber)

    someList = formless.List()
Пример #10
0
        class IDumb(formless.TypedInterface):
            def foo(bar=formless.String()):
                return formless.String()

            foo = formless.autocallable(foo)
Пример #11
0
        class IFormyThing(formless.TypedInterface):
            def choiceyFunc(arg=formless.Choice(["one", "two"],
                                                required=True)):
                pass

            choiceyFunc = formless.autocallable(choiceyFunc)
Пример #12
0
        class ITest(formless.TypedInterface):
            def foo(foo=formless.String()):
                pass

            foo = formless.autocallable(foo)
Пример #13
0
        class IMethod(formless.TypedInterface):
            def foo():
                pass

            foo = formless.autocallable(foo)
Пример #14
0
        class IMyInterface(formless.TypedInterface):
            def theFunc(test=typedinst):
                pass

            theFunc = formless.autocallable(theFunc)
Пример #15
0
        class IFoo(formless.TypedInterface):
            def sig(abc=formless.String()):
                pass

            foo = formless.autocallable(sig)
            bar = formless.autocallable(sig, action='FooFooFOo')
Пример #16
0
        class IFoo(formless.TypedInterface):
            def foo(abc=formless.String()):
                pass

            foo = formless.autocallable(foo, action='FooFooFoo')
Пример #17
0
        class IAPasswordMethod(formless.TypedInterface):
            def password(pword=formless.Password(),
                         integer=formless.Integer()):
                pass

            password = formless.autocallable(password)
Пример #18
0
class IAnotherTest(formless.TypedInterface):
    def aBarMethod(abar=formless.Object(interface=IBar)):
        """A Bar Method
        
        This method takes a bar, but there are no bar instances on this page.
        You'll have to use the shelf.
        """
        return str

    aBarMethod = formless.autocallable(aBarMethod)

    def aFrobMethod(aFrob=formless.Object(interface=IFrob)):
        """A Frob Method
        
        This method takes a frob, but there are no frob instances on this page.
        You'll have to use the shelf.
        """
        return str

    aFrobMethod = formless.autocallable(aFrobMethod)

    def whatIsMyClass(anObj=formless.Object()):
        """What is my class?
        
        Pass an object and get back the class in your hand.
        """
        return formless.Object()

    whatIsMyClass = formless.autocallable(whatIsMyClass)

    def setBreakpoint(breakpoint=formless.String()):
        """Set a breakpoint

        Set a breakpoint at the given filename and line number. String passed is equivalent
        to doing b(reak) ([file:]lineno | function) in pdb.
        """
        return None

    setBreakpoint = formless.autocallable(setBreakpoint)

    breakpoints = formless.List()

    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

    compoundTest = formless.autocallable(compoundTest)

    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)

    compoundChecker = formless.autocallable(compoundChecker)