Coverage for gws-app/gws/plugin/model_value/static/__init__.py: 0%

10 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""Static value. 

2 

3Returns a fixed configured value. Often used with ``isDefault`` to provide a 

4default for new features, or as a bound of a range validator. 

5 

6Example:: 

7 

8 fields+ { 

9 name "status" 

10 type "text" 

11 values+ { type "static" value "new" isDefault true forRead false } 

12 } 

13""" 

14 

15from typing import Any 

16 

17 

18import gws 

19import gws.base.model.value 

20 

21 

22@gws.ext.config.modelValue('static') 

23class Config(gws.base.model.value.Config): 

24 """Fixed value.""" 

25 

26 value: Any 

27 """Static value to return.""" 

28 

29 

30@gws.ext.object.modelValue('static') 

31class Object(gws.base.model.value.Object): 

32 """Static value object.""" 

33 

34 def compute(self, field, feature, mc): 

35 return self.cfg('value')