Commit 21b1c6a
committed
LazyToolBox: defer to super().to_dict for in_panel=True listings
``LazyToolBox.to_dict`` returned a flat list of every index entry
regardless of ``in_panel``. The eager ``to_dict(in_panel=True, view=X)``
walks ``tool_panel_contents`` which yields the Tools and ToolSections
captured in ``_tool_panel_view_rendered[X]`` — the section-aware
shape the UI and tests expect.
``test_only_latest_version_in_panel_fastp`` queries
``tools?in_panel=True&view=custom_13`` and expects exactly one
``ToolSection`` (test_section_multi) containing the installed
fastp. Under the lazy flat-only ``to_dict``, the response was a flat
list of every indexed tool with no ToolSection markers, so the
``[x for x in result if x['model_class'] == 'ToolSection']`` filter
in the test came back empty.
Fix: when ``in_panel=True``, defer to the parent's to_dict (which
already does the right thing — and ``ToolBoxRegistry.get_tool``
inside ``apply_view`` lazy-loads only the tools the view actually
references). Keep the cheap flat path for ``in_panel=False`` where
no tool loading is needed.1 parent 031c027 commit 21b1c6a
1 file changed
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1917 | 1917 | | |
1918 | 1918 | | |
1919 | 1919 | | |
1920 | | - | |
1921 | | - | |
1922 | | - | |
1923 | | - | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
1924 | 1930 | | |
1925 | 1931 | | |
1926 | 1932 | | |
1927 | 1933 | | |
1928 | | - | |
| 1934 | + | |
| 1935 | + | |
1929 | 1936 | | |
| 1937 | + | |
1930 | 1938 | | |
1931 | 1939 | | |
1932 | 1940 | | |
| |||
0 commit comments