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

12 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-16 22:59 +0200

1"""Format value. 

2 

3This value is computed by applying python `format` to feature attributes. 

4""" 

5 

6import gws 

7import gws.base.model.value 

8 

9gws.ext.new.modelValue('format') 

10 

11 

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

13 """Format value configuration.""" 

14 

15 format: str 

16 """Format string to apply to feature attributes.""" 

17 

18 

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

20 format: str 

21 

22 def configure(self): 

23 self.format = self.cfg('format') 

24 

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

26 return gws.u.format_map(self.format, feature.attributes)