format_multivalue#
- minim.utility.format_multivalue(value: Any, multivalue: bool, *, primary: bool = False, sep: str | tuple[str] = (', ', ' & ')) str | list[Any] [source]#
Format a field value based on whether multivalue for that field is supported.
- Parameters:
- valueAny
Field value to format.
- multivaluebool
Determines whether multivalue tags are supported. If
False
, the items in value are concatenated using the separator(s) specified in sep.- primarybool, keyword-only, default:
False
Specifies whether the first item in value should be used when value is a list and
multivalue=False
.- sepstr or tuple, keyword-only, default:
(", ", " & ")
Separator(s) to use to concatenate multivalue tags. If a
str
is provided, it is used to concatenate all values. If atuple
is provided, the firststr
is used to concatenate all values except the last, and the secondstr
is used to append the final value.
- Returns:
- valueAny
Formatted field value.