Serialize subsections as dictionaries
We are currently (de-)serialising (m_to_dict
, m_from_dict
) repeating sub-sections as lists. As lists are basically "integer keyed dicts", we could offer dicts as an alternative. This could be done transparently for deserialising and per flag on serialising.
Further, we have the concept of a "label_quantity" already. This is implemented very softly as a more
quantity on sections. This is used by the archive browser in the UI to show values instead of numbers when presenting subsections.
Further, we added specialised deserialisation for schemas to support dicts for the quantities
and sub_sections
sub section of Section
and section_definitions
and category_definitions
sub section of Package
. Maybe there is more for attributes?
This is how this could get implemented more properly:
-
SubSection
gets a newkey_quantity: Quantity
property that refers to a quantity in the SubSection'ssub_section:Section
. If thesub_section
has a quantity withmore.label_quantity
, we use this askey_quantity
for backwards compatibility. - When a sub section with
key_quantity
is set or deserialised, we check if the key quantity has unique values for all sub sections. -
m_from_dict
deals both with dicts or lists. -
m_to_dict
has three modes: always dict, always list, dict ifkey_quantity
is set (default). - The UI deals with both lists and dicts. We remove the treatment of the old
more.label_quantity
. - We remove the specialised
m_from_dict
implementations on the schema classesSection
,Package
.
This could also be beneficial for the new graph API #1180 (closed) which uses dicts to realise a sub-section-like relationship between uploads->entries, users->uploads, etc.