Unexpected re-hydration on isinstance-check #688
Labels
severity: low
Does not significantly disrupt application functionality, or a workaround is available
status: needs owner
This issue is tentatively accepted pending a volunteer committed to its implementation
type: bug
A confirmed report of unexpected behavior in the application
pynetbox version
v.7.4.1
NetBox version
v4.2.6
Python version
3.11
Steps to Reproduce
When doing isinstance-checks on a Record, there's a chance of re-hydration happening, with two unwanted effects:
For instance, the internal instance check of BaseModel of Pydantic, will perform a
hasattr(instance, '__pydantic_decorators__')
on the Record, triggeringRecord.__getattr__
and thus a re-hydration.Example:
Expected Behavior
Local updates on the Record should persist after __getattr__ is called by overloaded instance checks. Furthermore, not doing a network call in this case would be preferable.
Specifically, I'm suggesting the following change to
Record.__getattr__
.along with the following change to
Record.full_details
Observed Behavior
See code comments in "Steps to Reproduce"
The text was updated successfully, but these errors were encountered: