11 | | For tickets, when a field is unset, we currently put the value back to the empty string. This was not always the case, as we used to reset it to `None` / `NULL` which is still what we do in some situations (retargeting tickets to no milestone after a milestone delete/close). See #7691 and #11018. |
12 | | |
13 | | We should standardize on `NULL` again. When retrieving `NULL` values from the database, we get `None` in Python. If needed, we can carry on this distinct meaning yet manipulate it as a string by converting `None` to the special value [apidoc:api/trac_util_text#trac.util.text.empty empty]. See e.g. what we do for [source:trunk/trac/ticket/model.py@11111:127,137#L110 ticket fields]. |
| 11 | For tickets, when a field is unset or set to an empty string the database value it set to `None` / `NULL` (#11018). When retrieving `NULL` values from the database, we get `None` in Python, and the empty string is returned from the model using the special value [apidoc:api/trac_util_text#trac.util.text.empty empty]. See e.g. what we do for [source:trunk/trac/ticket/model.py@11111:127,137#L110 ticket fields]. The pattern could be extended to other model classes, and even the `Ticket` model should be reviewed to ensure that all fields follow the pattern. |