-
Notifications
You must be signed in to change notification settings - Fork 136
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
Passing filename as the default form id parameter. #389
Conversation
Codecov Report
@@ Coverage Diff @@
## master #389 +/- ##
==========================================
+ Coverage 82.42% 82.42% +<.01%
==========================================
Files 23 23
Lines 3260 3261 +1
Branches 763 763
==========================================
+ Hits 2687 2688 +1
+ Misses 433 432 -1
- Partials 140 141 +1
Continue to review full report at Codecov.
|
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.
Apologies for not noticing this problem in the pyxform/tests/test_expected_output/survey_no_name.xml
test output originally! I think some clearer naming would help make it more explicit what the relationship between the existing form_name
parameter and the new parameter is. Previously I didn't realize that form_name
was being used for the root node, the form title and the form ID.
pyxform/xls2json.py
Outdated
workbook_dict, form_name=None, default_language="default", warnings=None | ||
workbook_dict, | ||
form_name=None, | ||
form_id=None, |
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.
How about calling this new parameter fallback_form_name
so it's clear that it's a companion to form_name
that's only used as a fallback?
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.
Updated to fallback_form_name. I think it makes sense to call it that way.
pyxform/xls2json.py
Outdated
@@ -1316,7 +1320,10 @@ def parse_file_to_json( | |||
if warnings is None: | |||
warnings = [] | |||
workbook_dict = parse_file_to_workbook_dict(path, file_object) | |||
return workbook_to_json(workbook_dict, default_name, default_language, warnings) | |||
default_form_id = unicode(get_filename(path)) |
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.
I think calling this local value fallback_form_name
would also be more helpful.
Modify the 'test_spaced_xlsform' to ensure that a file with an invalid filename is caught and handled. More Info: XLSForm/pyxform#389
Modify the 'test_spaced_xlsform' to ensure that a file with an invalid filename is caught and handled. More Info: XLSForm/pyxform#389
Modify the 'test_spaced_xlsform' to ensure that a file with an invalid filename is caught and handled. More Info: XLSForm/pyxform#389
Modify the 'test_spaced_xlsform' to ensure that a file with an invalid filename is caught and handled. More Info: XLSForm/pyxform#389
Update the error raised when an id_string is invalid. PyXForm now utilizes the filename as the form_id if it's not explicitly set in the settings sheet. More Info: XLSForm/pyxform#389
Update the error raised when an id_string is invalid. PyXForm now utilizes the filename as the form_id if it's not explicitly set in the settings sheet. More Info: XLSForm/pyxform#389
Update the error raised when an id_string is invalid. PyXForm now utilizes the filename as the form_id if it's not explicitly set in the settings sheet. More Info: XLSForm/pyxform#389
Update the error raised when an id_string is invalid. PyXForm now utilizes the filename as the form_id if it's not explicitly set in the settings sheet. More Info: XLSForm/pyxform#389
Update the error raised when an id_string is invalid. PyXForm now utilizes the filename as the form_id if it's not explicitly set in the settings sheet. More Info: XLSForm/pyxform#389
Update the error raised when an id_string is invalid. PyXForm now utilizes the filename as the form_id if it's not explicitly set in the settings sheet. More Info: XLSForm/pyxform#389
Update the error raised when an id_string is invalid. PyXForm now utilizes the filename as the form_id if it's not explicitly set in the settings sheet. More Info: XLSForm/pyxform#389
Update the error raised when an id_string is invalid. PyXForm now utilizes the filename as the form_id if it's not explicitly set in the settings sheet. More Info: XLSForm/pyxform#389
Fix #388.
Introduce a new parameter for the
workbook_to_json
by passing the xls filename as the default value for the form_id. This will be replaced with value from thesettings
tab if supplied.