Opened 17 years ago

Closed 17 years ago

#13 closed defect (fixed)

ChoiceOf constraint is broken

Reported by: Brian Warner Owned by:
Priority: major Milestone: 0.1.6
Component: schemas Version: 0.1.5
Keywords: Cc:

Description

robk ran into this one. I think the patch is to add a method override to PolyConstraint:

    def checkToken(self, typebyte, size):
        ok = False
        for c in self.alternatives:
            try:
                c.checkToken(typebyte, size)
                ok = True
            except (Violation, BananaError):
                pass
        if not ok:
            raise Violation("does not satisfy any of %s" \
                            % (self.alternatives,))

Although it seems like the raise BananaError in Constraint.checkToken (used as the default for a lot of Constraint subclasses) is inappropriate, and maybe it should be raising a Violation instead. I'll have to think about the implications of that.

Change History (3)

comment:1 Changed 17 years ago by Brian Warner

Component: unknownschemas

comment:2 Changed 17 years ago by Brian Warner

Milestone: undecided0.1.6

comment:3 Changed 17 years ago by Brian Warner

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.