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

0 statements  

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

1"""Model values. 

2 

3Each subpackage implements one value type (``gws.ext.object.modelValue``). 

4Values are configured in the ``values`` list of a model field and compute the 

5field value when a feature is read, created or updated (``forRead``, 

6``forCreate``, ``forUpdate``). With ``isDefault``, the value is used only when 

7no other value is provided. Values also serve as bounds for range validators. 

8 

9- ``current_timestamp``: the current date and time. 

10- ``current_user``: the login name of the current user, or a formatted string. 

11- ``expression``: the result of a Python expression. 

12- ``format``: a format string applied to the feature attributes. 

13- ``static``: a fixed value. 

14 

15Example:: 

16 

17 fields+ { 

18 name "updated_by" 

19 type "text" 

20 values+ { type "currentUser" forRead false forUpdate true } 

21 } 

22 

23 fields+ { 

24 name "status" 

25 type "text" 

26 values+ { type "static" value "new" isDefault true } 

27 } 

28"""