# HG changeset patch # User Julien Cristau # Date 1452077228 -3600 # Node ID 245f440b814a00b0a8b6bc9cb2686fbece0fe4da # Parent eba98431f705b093781ccac41420c2594159f922 [devtools] fix get_bounds Say an attribute has two IntervalBoundConstraints, one with minvalue=0 and the other with maxvalue=10 (not literally, or that could be a single constraint, but e.g. with references to other attributes). We don't want to override the minvalue of the former with None just because the latter happens last in the constraints list. This doesn't fix the case where two constraints both have a min or a max value. Meh. diff -r eba98431f705 -r 245f440b814a devtools/fill.py --- a/devtools/fill.py Wed Jan 06 15:27:59 2016 +0100 +++ b/devtools/fill.py Wed Jan 06 11:47:08 2016 +0100 @@ -217,8 +217,10 @@ minvalue = maxvalue = None for cst in self.eschema.rdef(attrname).constraints: if isinstance(cst, IntervalBoundConstraint): - minvalue = self._actual_boundary(entity, attrname, cst.minvalue) - maxvalue = self._actual_boundary(entity, attrname, cst.maxvalue) + if cst.minvalue is not None: + minvalue = self._actual_boundary(entity, attrname, cst.minvalue) + if cst.maxvalue is not None: + maxvalue = self._actual_boundary(entity, attrname, cst.maxvalue) elif isinstance(cst, BoundaryConstraint): if cst.operator[0] == '<': maxvalue = self._actual_boundary(entity, attrname, cst.boundary)