ModelBase._as_dict() makes assumptions about __dict__ that are changing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.db |
New
|
Undecided
|
Unassigned |
Bug Description
in SQLAlchemy https:/
obj = SomeObject()
print(
You'll still get the usual [] for `some_collection` or whatever it's supposed to be. But it's not going to be in `__dict__` until you mutate it, which is the same behavior as when you say "obj.some_column". You get None back but that's also not in `__dict__`.
Where this breaks is here:
https:/
which is because nova over here is relying upon the list being implicitly present in `__dict__` in these tests, specifically for the "rules" attribute:
https:/
their comparison thing turns the object into dictionaries using _as_dict() here and expects the blank collection to be present, which is because they are implicitly setting it up here:
https:/
now, the fix may be just for them to correctly say this instead:
security_
i might go that route instead.
Nova will probably be accepting my patch for this in https:/ /review. opendev. org/#/c/ 661472/ 1 , I don't have plans to change oslo.db right now though I'm not super enthusiastic about how that function works.