Fix AttributeError on CO journal/changelog/contacts pages (#19) - #20
Merged
Merged
Conversation
The 2.6.0 (label, weight) active-tab fallback in plugin_extra_tabs assumed context["tab"] is always a ViewTab, but netbox-custom-objects' journal, changelog, contacts and configcontext views set it to a plain str, so every such page raised "'str' object has no attribute 'label'" whenever at least one combined/typed tab was registered for the CO model. Read label/weight with getattr; a str marker now just yields "not active". Also exclude the NetBox-auto-registered `contacts` ViewTab (features.py, since 4.3) from plugin_extra_tabs: the CO template renders Contacts by hand, so the registry entry produced a duplicate, never-active tab. Release 2.6.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a regression introduced in 2.6.0 in
plugin_extra_tabsand removes a duplicate Contacts tab on custom-object pages.Problem
The 2.6.0
(label, weight)active-tab fallback inplugin_extra_tabsassumedcontext["tab"]is always aViewTab. However, netbox-custom-objects' journal, changelog, contacts and configcontext views set it to a plainstr, so every such page raised:whenever at least one combined/typed tab was registered for the CO model.
Additionally, the NetBox-auto-registered
contactsViewTab(features.py, since 4.3) was being picked up byplugin_extra_tabs. The CO template already renders Contacts by hand, so the registry entry produced a duplicate, never-active tab.Changes
label/weightwithgetattr; astrmarker now simply yields "not active" instead of raising.contactsViewTabfromplugin_extra_tabs.