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)
class Test(formless.TypedInterface): def noArgs(self): pass noArgs = formless.autocallable(noArgs) def oneArg(self, someParam=formless.String()): pass oneArg = formless.autocallable(oneArg)
class Inner(formless.TypedInterface): one = formless.Integer() two = formless.Integer() def buckleMyShoe(): pass buckleMyShoe = formless.autocallable(buckleMyShoe) def buriedAlive(): pass buriedAlive = formless.autocallable(buriedAlive)
class ISimpleTypedInterface(formless.TypedInterface): anInt = formless.Integer() def aMethod(aString=formless.String()): return None aMethod = formless.autocallable(aMethod)
class IBindingDefaults(formless.TypedInterface): def aMethod(foo=formless.String(default="The foo")): pass aMethod = formless.autocallable(aMethod) aProperty = formless.String(default="The property")
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)
class Test(formless.TypedInterface): def foo(foobar=formless.String()): """ Label for foo Description for foo """ pass foo = formless.autocallable(foo, action="Do something!")
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)
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()
class IDumb(formless.TypedInterface): def foo(bar=formless.String()): return formless.String() foo = formless.autocallable(foo)
class IFormyThing(formless.TypedInterface): def choiceyFunc(arg=formless.Choice(["one", "two"], required=True)): pass choiceyFunc = formless.autocallable(choiceyFunc)
class ITest(formless.TypedInterface): def foo(foo=formless.String()): pass foo = formless.autocallable(foo)
class IMethod(formless.TypedInterface): def foo(): pass foo = formless.autocallable(foo)
class IMyInterface(formless.TypedInterface): def theFunc(test=typedinst): pass theFunc = formless.autocallable(theFunc)
class IFoo(formless.TypedInterface): def sig(abc=formless.String()): pass foo = formless.autocallable(sig) bar = formless.autocallable(sig, action='FooFooFOo')
class IFoo(formless.TypedInterface): def foo(abc=formless.String()): pass foo = formless.autocallable(foo, action='FooFooFoo')
class IAPasswordMethod(formless.TypedInterface): def password(pword=formless.Password(), integer=formless.Integer()): pass password = formless.autocallable(password)
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)