40 |
40 |
41 from cubicweb import Binary |
41 from cubicweb import Binary |
42 from cubicweb.schema import RQLConstraint |
42 from cubicweb.schema import RQLConstraint |
43 |
43 |
44 def custom_range(start, stop, step): |
44 def custom_range(start, stop, step): |
|
45 if start == stop: |
|
46 yield start |
|
47 return |
45 while start < stop: |
48 while start < stop: |
46 yield start |
49 yield start |
47 start += step |
50 start += step |
48 |
51 |
49 def decompose_b26(index, ascii=False): |
52 def decompose_b26(index, ascii=False): |
212 |
215 |
213 def get_bounds(self, entity, attrname): |
216 def get_bounds(self, entity, attrname): |
214 minvalue = maxvalue = None |
217 minvalue = maxvalue = None |
215 for cst in self.eschema.rdef(attrname).constraints: |
218 for cst in self.eschema.rdef(attrname).constraints: |
216 if isinstance(cst, IntervalBoundConstraint): |
219 if isinstance(cst, IntervalBoundConstraint): |
217 minvalue = self._actual_boundary(entity, attrname, cst.minvalue) |
220 if cst.minvalue is not None: |
218 maxvalue = self._actual_boundary(entity, attrname, cst.maxvalue) |
221 minvalue = self._actual_boundary(entity, attrname, cst.minvalue) |
|
222 if cst.maxvalue is not None: |
|
223 maxvalue = self._actual_boundary(entity, attrname, cst.maxvalue) |
219 elif isinstance(cst, BoundaryConstraint): |
224 elif isinstance(cst, BoundaryConstraint): |
220 if cst.operator[0] == '<': |
225 if cst.operator[0] == '<': |
221 maxvalue = self._actual_boundary(entity, attrname, cst.boundary) |
226 maxvalue = self._actual_boundary(entity, attrname, cst.boundary) |
222 else: |
227 else: |
223 minvalue = self._actual_boundary(entity, attrname, cst.boundary) |
228 minvalue = self._actual_boundary(entity, attrname, cst.boundary) |