-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
netboxstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: documentationA change or addition to the documentationA change or addition to the documentation
Description
Change Type
Correction
Area
Customization
Proposed Changes
The current examples of using class Meta: should be class Meta(Script.Meta): to use the correct type when overriding.
See the error:
"Meta" overrides symbol of same name in class "BaseScript"
"netbox.scripts.scripts.sample_script.MyScript.Meta" is not assignable to "netbox.extras.scripts.BaseScript.Meta"
Type "type[netbox.scripts.scripts.sample_script.MyScript.Meta]" is not assignable to type "type[netbox.extras.scripts.BaseScript.Meta]"
from Pylance reportIncompatibleVariableOverride
The suggested change is:
diff --git a/docs/customization/custom-scripts.md b/docs/customization/custom-scripts.md
index 936dfd868..15d6c81f0 100644
--- a/docs/customization/custom-scripts.md
+++ b/docs/customization/custom-scripts.md
@@ -95,7 +95,7 @@ An example fieldset definition is provided below:
```python
class MyScript(Script):
- class Meta:
+ class Meta(Script.Meta):
fieldsets = (
('First group', ('field1', 'field2', 'field3')),
('Second group', ('field4', 'field5')),
@@ -510,7 +510,7 @@ from extras.scripts import *
class NewBranchScript(Script):
- class Meta:
+ class Meta(Script.Meta):
name = "New Branch"
description = "Provision a new branch site"
field_order = ['site_name', 'switch_count', 'switch_model']I have prepared the PR but I noticed that I needed to open an issue first.
Metadata
Metadata
Assignees
Labels
netboxstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: documentationA change or addition to the documentationA change or addition to the documentation