예제 #1
0
class IListWithActions(formless.TypedInterface):
    def actionOne(theSubset = formless.List()):
        pass
    def actionTwo(theSubset = formless.List()):
        pass

    theListOfStuff = formless.List(actions=[actionOne, actionTwo])
예제 #2
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()
예제 #3
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)
예제 #4
0
 def actionTwo(theSubset = formless.List()):
     pass
예제 #5
0
 def actionOne(theSubset = formless.List()):
     pass