-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[FIX] Prevent crash when saving in unsupported format #5560
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5560 +/- ##
=======================================
Coverage 85.91% 85.92%
=======================================
Files 313 313
Lines 65349 65365 +16
=======================================
+ Hits 56143 56163 +20
+ Misses 9206 9202 -4 |
8301653
to
ff6f50c
Compare
Check widgets for reading. |
I checked: the File widget does not crash and even has a test for it. Load Model and Distance File have only a single extension and no registry. Unlike the widgets for saving, widgets for reading do not have a common base, so there's nothing to fix. This can be reviewed as is. Volunteers welcome. |
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.
Apart from that typo, I'd merge.
@@ -43,6 +43,7 @@ class Information(widget.OWWidget.Information): | |||
|
|||
class Error(widget.OWWidget.Error): | |||
no_file_name = widget.Msg("File name is not set.") | |||
unsupported_format = widget.Msg("File fornat is unsupported.\n{}") |
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.
fornat -> format
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.
Thamks! Fixed.
ff6f50c
to
e2ecd97
Compare
Issue
Fixes #5512.
The situtation can occur if workflow is saved with Orange that has add-ons with additional file formats and then opened in Orange without that add-on, or if support for some format is dropped (as was the case with old Excel, which caused #5512).
Description of changes
Save widget base
Widgets for saving are derived from
OWSaveBase
, which fails in propertywriter
. This PR changes it to returnNone
for filters that are not in the list. The only place wherewriter
is used isdo_save
, which in this case now indicates an error.The error is cleared at the only place that changes
self.filter
: if the user selects a new file name, the filter cannot be invalid.Derived widgets
Derived widgets need changes only if they use
self.writer
, in which case they must check that it is notNone
. Among the three core widgets, onlySave
does, and this PR adapts it accordingly.Save Model
andSave Distances
shouldn't need any changes.The consequence of not checking for
self.writer is None
is a crash -- like previously, just a bit later (when using the property instead of when obtaining it).Includes