Total Complexity | 2 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 50% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # coding: utf-8 |
||
9 | 1 | class MaxTime(Model): |
|
10 | 1 | near = FloatType( |
|
11 | min_value=0.1, |
||
12 | max_value=30.0, |
||
13 | default=2.0, |
||
14 | required=True, |
||
15 | ) |
||
16 | 1 | far = FloatType( |
|
17 | min_value=0.1, |
||
18 | max_value=30.0, |
||
19 | default=10.0, |
||
20 | required=True, |
||
21 | ) |
||
22 | |||
23 | 1 | def validate_far(self, data, value): |
|
24 | near = data['near'] |
||
25 | |||
26 | if value < near: |
||
27 | raise ValidationError( |
||
28 | "'far' value ({far}) cannot be less than 'near' value ({near})." |
||
29 | .format(far=value, near=near) |
||
30 | ) |
||
31 | |||
32 | return value |
||
33 | |||
57 |