You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Harden 0.5.0 upgrade gate in PluginConfig.ready() #14
Follow-up to #13. Two CodeRabbit findings on netbox_custom_objects_tab/__init__.py that did not block the 2.4.0 release but are worth a small patch.
1. Broaden the exception catch in the upgrade gate (major)
PluginConfig.ready() currently catches only FieldDoesNotExist when probing for the is_polymorphic model field. If netbox-custom-objects is not installed at all (the user removed it from PLUGINS but left netbox-custom-objects-tab enabled), the import line above the try block raises ModuleNotFoundError and the friendly ImproperlyConfigured message never fires — the user sees a less actionable Python import error.
Suggested fix: wrap both the import and the _meta.get_field(...) probe in a single try block, catching ModuleNotFoundError, ImportError, AttributeError, and FieldDoesNotExist. Re-raise the same ImproperlyConfigured with the existing upgrade message.
2. Drop the hardcoded "2.4+" version in the gate's error message (minor)
The literal 2.4+ will drift as the plugin version progresses. Either interpolate __version__ from the module, or drop the version qualifier entirely ("netbox-custom-objects-tab requires netbox-custom-objects>=0.5.0") — same information without the maintenance burden.
Acceptance criteria
__init__.py::ready() produces a friendly ImproperlyConfigured when netbox-custom-objects is missing or older than 0.5.0
The error message no longer contains a hardcoded plugin version string
Existing 0.5.0+ behaviour unchanged
No new tests required (the gate is exercised by deployment, not unit tests)
Activity