-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.4 forgiving of 1.5 or other future versions. #185
Conversation
…sions that can introduce new fields
… be forgiving when reading from JSON - in case it is produced by a later version of the library that has new fields
Tested by installing
|
If your code (or someone's code) does
|
This may mess up other logging, of course |
Since, this only goes in |
Let me look at it some more - I don't quite understand the root logger behavior - I can see that calling |
Seems like this is the logging behavior - if a root logger has a handler - it intercepts all messages. logging.basicConfig() installs a root logger with a stream handler and then it intercepts messages. Sounds like what you are saying is if we mess with the root logger we will turn off logging elsewhere, which is undesirable - so we don't have any choice, I think, but to live with these log messages. |
We may need a ticket for fablib or other libraries to make sure they do not do logging.basicConfig() and use root loggers in the future. Instead create module-specific loggers and configure them individually. |
For now, I am pushing a pypi version of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Made all children of JSONField forgiving based on a set_fields(forgiving) value which by default is set to
False
. So normally these classes will throw exceptions if an attempt to set a non-existent field is made. However when deserializing from JSON they are more forgiving and just print warnings.Note that because FIM normally stored unaltered GraphML, if you have a topology produced with a later version of FIM that has new fields not known to this version, it will load the graph and will print warnings every time you try to access the fields. If you want to get rid of all FIM warnings do something like this:
This is posted on PyPi as
fabric_fim==1.4.14
.@kthare10 please test - I won't merge until you are good with these changes.