Allow datagrid Column subclasses to set attributes on the class level.
Review Request #14824 — Created Feb. 17, 2026 and updated
Historically,
Columnsubclasses had to override__init__and set
attributes there. This was a bit messy and error-prone, as it was common
to mix up positional and keyword arguments when subclassing, and made
for harder customization for more complex class hierarchies.Now, subclasses can set these arguments directly on the class as
attributes. The baseColumnclass has defaults for all these fields,
which can be overridden by subclasses and further overridden when
calling__init__(). Built-in subclasses also provide their own fitting
this pattern.To make this work, the arguments in
__init__()are all set toUNSET
by default. IfUNSET, class attributes (or more complex default
calculations) are used, but if any value is explicitly provided, it will
be used instead.To help avoid the mess of positional and keyword arguments in these
classes, all arguments other thanlabelare now keyword-only, with
positional arguments deprecated and scheduled for removal in Djblets 7.This is now the recommended approach for column subclasses. It has the
benefit of storing less state per-instance, as well, as we only set the
values on the instance if they're explicitly provided during
construction.
Unit tests pass.
Tested updating existing columns to use this, and verified the new
settings were correct.