Skip to content

Commit

Permalink
select is not a valid bind type
Browse files Browse the repository at this point in the history
  • Loading branch information
yanokwa committed Dec 20, 2019
1 parent a377ed8 commit 3723bb6
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion pyxform/question.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def validate(self):
choice.validate()

def xml_control(self):
assert self.bind["type"] in ["select", "string", "odk:rank"]
assert self.bind["type"] in ["string", "odk:rank"]
survey = self.get_root()
control_dict = self.control.copy()
# Resolve field references in attributes
Expand Down
12 changes: 6 additions & 6 deletions pyxform/question_type_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def generate_new_dict():
},
"add select multiple prompt using": {
"control": {"tag": "select"},
"bind": {"type": "select"},
"bind": {"type": "string"},
},
"add note prompt": {
"control": {"tag": "input"},
Expand All @@ -61,7 +61,7 @@ def generate_new_dict():
"text": {"control": {"tag": "input"}, "bind": {"type": "string"}},
"select all that apply from": {
"control": {"tag": "select"},
"bind": {"type": "select"},
"bind": {"type": "string"},
},
"simserial": {
"bind": {
Expand Down Expand Up @@ -136,7 +136,7 @@ def generate_new_dict():
"control": {"tag": "upload", "mediatype": "image/*"},
"bind": {"type": "binary"},
},
"select all that apply": {"control": {"tag": "select"}, "bind": {"type": "select"}},
"select all that apply": {"control": {"tag": "select"}, "bind": {"type": "string"}},
"get end time": {
"bind": {
"jr:preload": "timestamp",
Expand All @@ -152,7 +152,7 @@ def generate_new_dict():
"geopoint": {"control": {"tag": "input"}, "bind": {"type": "geopoint"}},
"geoshape": {"control": {"tag": "input"}, "bind": {"type": "geoshape"}},
"geotrace": {"control": {"tag": "input"}, "bind": {"type": "geotrace"}},
"select multiple from": {"control": {"tag": "select"}, "bind": {"type": "select"}},
"select multiple from": {"control": {"tag": "select"}, "bind": {"type": "string"}},
"end time": {
"bind": {
"jr:preload": "timestamp",
Expand All @@ -175,7 +175,7 @@ def generate_new_dict():
}
},
"q barcode": {"control": {"tag": "input"}, "bind": {"type": "barcode"}},
"q select": {"control": {"tag": "select"}, "bind": {"type": "select"}},
"q select": {"control": {"tag": "select"}, "bind": {"type": "string"}},
"select one using": {"control": {"tag": "select1"}, "bind": {"type": "string"}},
"rank": {"control": {"tag": "odk:rank"}, "bind": {"type": "odk:rank"}},
"image": {
Expand Down Expand Up @@ -236,7 +236,7 @@ def generate_new_dict():
},
"int": {"control": {"tag": "input"}, "bind": {"type": "int"}},
"add barcode prompt": {"control": {"tag": "input"}, "bind": {"type": "barcode"}},
"select multiple using": {"control": {"tag": "select"}, "bind": {"type": "select"}},
"select multiple using": {"control": {"tag": "select"}, "bind": {"type": "string"}},
"q decimal": {"control": {"tag": "input"}, "bind": {"type": "decimal"}},
"end": {
"bind": {
Expand Down
2 changes: 1 addition & 1 deletion pyxform/tests/example_xls/spec_test_expected_output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@
<bind constraint=". &lt;= /xlsform_spec_test/everything/a_integer" nodeset="/xlsform_spec_test/everything/a_decimal" type="decimal"/>
<bind nodeset="/xlsform_spec_test/everything/num_repeat_times" relevant="false()" type="int"/>
<bind nodeset="/xlsform_spec_test/everything/repeat_test/group_test/required_text" required="true()" type="string"/>
<bind constraint="not(selected(., 'yes') and selected (., 'no'))" jr:constraintMsg="you can't select yes and no" nodeset="/xlsform_spec_test/everything/repeat_test/group_test/select_multiple_test" required="false()" type="select"/>
<bind constraint="not(selected(., 'yes') and selected (., 'no'))" jr:constraintMsg="you can't select yes and no" nodeset="/xlsform_spec_test/everything/repeat_test/group_test/select_multiple_test" required="false()" type="string"/>
<bind nodeset="/xlsform_spec_test/everything/repeat_test/labeled_select_group/label-test" type="string"/>
<bind nodeset="/xlsform_spec_test/everything/repeat_test/labeled_select_group/list-nolabel-test" required="true()" type="string"/>
<bind nodeset="/xlsform_spec_test/everything/repeat_test/name/reserved_name_for_field_list_labels_23" type="string"/>
Expand Down
16 changes: 8 additions & 8 deletions pyxform/tests/example_xls/widgets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<bind constraint=". &gt; 10.51 and . &lt; 18.39" jr:constraintMsg="number must be between 10.51 and 18.39" nodeset="/widgets/my_decimal" type="decimal"/>
<bind constraint=". &gt;= today()" jr:constraintMsg="only future dates allowed" nodeset="/widgets/my_date" type="date"/>
<bind nodeset="/widgets/my_time" type="time"/>
<bind constraint="not(selected(., 'c') and selected(., 'd'))" jr:constraintMsg="option c and d cannot be selected together" nodeset="/widgets/my_select" type="select"/>
<bind constraint="not(selected(., 'c') and selected(., 'd'))" jr:constraintMsg="option c and d cannot be selected together" nodeset="/widgets/my_select" type="string"/>
<bind nodeset="/widgets/my_select1" type="string"/>
<bind nodeset="/widgets/my_output" readonly="true()" type="string"/>
<bind nodeset="/widgets/my_geopoint" type="geopoint"/>
Expand All @@ -127,7 +127,7 @@
<bind nodeset="/widgets/locationMap" type="geopoint"/>
<bind nodeset="/widgets/dateTime" type="dateTime"/>
<bind nodeset="/widgets/spinner" type="string"/>
<bind nodeset="/widgets/spinner_all" type="select"/>
<bind nodeset="/widgets/spinner_all" type="string"/>
<bind nodeset="/widgets/selectadvance" type="string"/>
<bind nodeset="/widgets/grid_test" type="string"/>
<bind nodeset="/widgets/grid_test_audio" type="string"/>
Expand All @@ -138,13 +138,13 @@
<bind nodeset="/widgets/table_list_test2/reserved_name_for_field_list_labels_30" type="string"/>
<bind nodeset="/widgets/table_list_test2/table_list_3" type="string"/>
<bind nodeset="/widgets/table_list_test2/table_list_4" type="string"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_second_method" type="select"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_brian2" type="select"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_michael2" type="select"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_second_method" type="string"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_brian2" type="string"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_michael2" type="string"/>
<bind nodeset="/widgets/happy_sad_table/generated_table_list_label_38" readonly="true()" type="string"/>
<bind nodeset="/widgets/happy_sad_table/reserved_name_for_field_list_labels_39" type="select"/>
<bind nodeset="/widgets/happy_sad_table/happy_sad_brian" type="select"/>
<bind nodeset="/widgets/happy_sad_table/happy_sad_michael" type="select"/>
<bind nodeset="/widgets/happy_sad_table/reserved_name_for_field_list_labels_39" type="string"/>
<bind nodeset="/widgets/happy_sad_table/happy_sad_brian" type="string"/>
<bind nodeset="/widgets/happy_sad_table/happy_sad_michael" type="string"/>
<bind jr:preload="uid" nodeset="/widgets/meta/instanceID" readonly="true()" type="string"/>
</model>
</h:head>
Expand Down
2 changes: 1 addition & 1 deletion pyxform/tests/fixtures/strings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test_simple_date_question_type_multilingual_binding = <bind nodeset="/test/date_
test_simple_phone_number_question_type_multilingual_control = <input ref="/test/phone_number_q"><label ref="jr:itext('/test/phone_number_q:label')"/><hint>Enter numbers only.</hint></input>
test_simple_phone_number_question_type_multilingual_binding = <bind constraint="regex(., '^\d*$')" nodeset="/test/phone_number_q" type="string"/>
test_simple_select_all_question_multilingual_control = <select ref="/test/select_all_q"><label ref="jr:itext('/test/select_all_q:label')"/><item><label ref="jr:itext('/test/select_all_q/f:label')"/><value>f</value></item><item><label ref="jr:itext('/test/select_all_q/g:label')"/><value>g</value></item><item><label ref="jr:itext('/test/select_all_q/h:label')"/><value>h</value></item></select>
test_simple_select_all_question_multilingual_binding = <bind nodeset="/test/select_all_q" type="select"/>
test_simple_select_all_question_multilingual_binding = <bind nodeset="/test/select_all_q" type="string"/>
test_simple_decimal_question_multilingual_control = <input ref="/test/decimal_q"><label ref="jr:itext('/test/decimal_q:label')"/></input>
test_simple_decimal_question_multilingual_binding = <bind nodeset="/test/decimal_q" type="decimal"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@
<bind calculate="2" nodeset="/attribute_columns_test/everything/repeat_test_count" readonly="true()" type="string"/>
<bind bindAttribute="test" nodeset="/attribute_columns_test/everything/repeat_test"/>
<bind jr:requiredMsg="Custom required message." nodeset="/attribute_columns_test/everything/repeat_test/group_test/required_text" required="true()" type="string"/>
<bind constraint="not(selected(., 'yes') and selected (., 'no'))" jr:constraintMsg="jr:itext('/attribute_columns_test/everything/repeat_test/group_test/select_multiple_test:jr:constraintMsg')" nodeset="/attribute_columns_test/everything/repeat_test/group_test/select_multiple_test" required="false()" type="select"/>
<bind constraint="not(selected(., 'yes') and selected (., 'no'))" jr:constraintMsg="jr:itext('/attribute_columns_test/everything/repeat_test/group_test/select_multiple_test:jr:constraintMsg')" nodeset="/attribute_columns_test/everything/repeat_test/group_test/select_multiple_test" required="false()" type="string"/>
<bind nodeset="/attribute_columns_test/everything/repeat_test/labeled_select_group/label-test" type="string"/>
<bind nodeset="/attribute_columns_test/everything/repeat_test/labeled_select_group/list-nolabel-test" required="true()" type="string"/>
<bind nodeset="/attribute_columns_test/everything/repeat_test/name/reserved_name_for_field_list_labels_25" type="string"/>
Expand Down
2 changes: 1 addition & 1 deletion pyxform/tests/test_expected_output/flat_xlsform_test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@
<bind nodeset="/flat_xlsform_test/a_integer" relevant="not(selected( /flat_xlsform_test/skip_to_end , 'yes'))" type="int"/>
<bind constraint=". &lt;= /flat_xlsform_test/a_integer " nodeset="/flat_xlsform_test/a_decimal" relevant="not(selected( /flat_xlsform_test/skip_to_end , 'yes'))" type="decimal"/>
<bind jr:requiredMsg="Custom required message." nodeset="/flat_xlsform_test/required_text" relevant="not(selected( /flat_xlsform_test/skip_to_end , 'yes'))" required="true()" type="string"/>
<bind constraint="not(selected(., 'yes') and selected (., 'no'))" jr:constraintMsg="jr:itext('/flat_xlsform_test/select_multiple_test:jr:constraintMsg')" nodeset="/flat_xlsform_test/select_multiple_test" relevant="not(selected( /flat_xlsform_test/skip_to_end , 'yes'))" required="false()" type="select"/>
<bind constraint="not(selected(., 'yes') and selected (., 'no'))" jr:constraintMsg="jr:itext('/flat_xlsform_test/select_multiple_test:jr:constraintMsg')" nodeset="/flat_xlsform_test/select_multiple_test" relevant="not(selected( /flat_xlsform_test/skip_to_end , 'yes'))" required="false()" type="string"/>
<bind nodeset="/flat_xlsform_test/label-test" relevant="not(selected( /flat_xlsform_test/skip_to_end , 'yes'))" type="string"/>
<bind nodeset="/flat_xlsform_test/list-nolabel-test" relevant="not(selected( /flat_xlsform_test/skip_to_end , 'yes'))" required="true()" type="string"/>
<bind nodeset="/flat_xlsform_test/reserved_name_for_field_list_labels_25" relevant="not(selected( /flat_xlsform_test/skip_to_end , 'yes'))" type="string"/>
Expand Down
6 changes: 3 additions & 3 deletions pyxform/tests/test_expected_output/table-list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
<bind nodeset="/table-list/table_list_test2/table_list_3" type="string"/>
<bind nodeset="/table-list/table_list_test2/table_list_4" type="string"/>
<bind nodeset="/table-list/happy_sad_table/generated_table_list_label_7" readonly="true()" type="string"/>
<bind nodeset="/table-list/happy_sad_table/reserved_name_for_field_list_labels_8" type="select"/>
<bind nodeset="/table-list/happy_sad_table/happy_sad_brian" type="select"/>
<bind nodeset="/table-list/happy_sad_table/happy_sad_michael" type="select"/>
<bind nodeset="/table-list/happy_sad_table/reserved_name_for_field_list_labels_8" type="string"/>
<bind nodeset="/table-list/happy_sad_table/happy_sad_brian" type="string"/>
<bind nodeset="/table-list/happy_sad_table/happy_sad_michael" type="string"/>
<bind jr:preload="uid" nodeset="/table-list/meta/instanceID" readonly="true()" type="string"/>
</model>
</h:head>
Expand Down
16 changes: 8 additions & 8 deletions pyxform/tests/test_expected_output/widgets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<bind constraint=". &gt; 10.51 and . &lt; 18.39" jr:constraintMsg="number must be between 10.51 and 18.39" nodeset="/widgets/my_decimal" type="decimal"/>
<bind constraint=". &gt;= today()" jr:constraintMsg="only future dates allowed" nodeset="/widgets/my_date" type="date"/>
<bind nodeset="/widgets/my_time" type="time"/>
<bind constraint="not(selected(., 'c') and selected(., 'd'))" jr:constraintMsg="option c and d cannot be selected together" nodeset="/widgets/my_select" type="select"/>
<bind constraint="not(selected(., 'c') and selected(., 'd'))" jr:constraintMsg="option c and d cannot be selected together" nodeset="/widgets/my_select" type="string"/>
<bind nodeset="/widgets/my_select1" type="string"/>
<bind nodeset="/widgets/my_output" readonly="true()" type="string"/>
<bind nodeset="/widgets/my_geopoint" type="geopoint"/>
Expand All @@ -127,7 +127,7 @@
<bind nodeset="/widgets/locationMap" type="geopoint"/>
<bind nodeset="/widgets/dateTime" type="dateTime"/>
<bind nodeset="/widgets/spinner" type="string"/>
<bind nodeset="/widgets/spinner_all" type="select"/>
<bind nodeset="/widgets/spinner_all" type="string"/>
<bind nodeset="/widgets/selectadvance" type="string"/>
<bind nodeset="/widgets/grid_test" type="string"/>
<bind nodeset="/widgets/grid_test_audio" type="string"/>
Expand All @@ -138,13 +138,13 @@
<bind nodeset="/widgets/table_list_test2/reserved_name_for_field_list_labels_30" type="string"/>
<bind nodeset="/widgets/table_list_test2/table_list_3" type="string"/>
<bind nodeset="/widgets/table_list_test2/table_list_4" type="string"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_second_method" type="select"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_brian2" type="select"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_michael2" type="select"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_second_method" type="string"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_brian2" type="string"/>
<bind nodeset="/widgets/happy_sad_table_2/happy_sad_michael2" type="string"/>
<bind nodeset="/widgets/happy_sad_table/generated_table_list_label_38" readonly="true()" type="string"/>
<bind nodeset="/widgets/happy_sad_table/reserved_name_for_field_list_labels_39" type="select"/>
<bind nodeset="/widgets/happy_sad_table/happy_sad_brian" type="select"/>
<bind nodeset="/widgets/happy_sad_table/happy_sad_michael" type="select"/>
<bind nodeset="/widgets/happy_sad_table/reserved_name_for_field_list_labels_39" type="string"/>
<bind nodeset="/widgets/happy_sad_table/happy_sad_brian" type="string"/>
<bind nodeset="/widgets/happy_sad_table/happy_sad_michael" type="string"/>
<bind jr:preload="uid" nodeset="/widgets/meta/instanceID" readonly="true()" type="string"/>
</model>
</h:head>
Expand Down
2 changes: 1 addition & 1 deletion pyxform/tests/test_expected_output/xlsform_spec_test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@
<bind constraint=". &lt;= /xlsform_spec_test/everything/a_integer " nodeset="/xlsform_spec_test/everything/a_decimal" type="decimal"/>
<bind calculate="2" nodeset="/xlsform_spec_test/everything/repeat_test_count" readonly="true()" type="string"/>
<bind jr:requiredMsg="Custom required message." nodeset="/xlsform_spec_test/everything/repeat_test/group_test/required_text" required="true()" type="string"/>
<bind constraint="not(selected(., 'yes') and selected (., 'no'))" jr:constraintMsg="jr:itext('/xlsform_spec_test/everything/repeat_test/group_test/select_multiple_test:jr:constraintMsg')" nodeset="/xlsform_spec_test/everything/repeat_test/group_test/select_multiple_test" required="false()" type="select"/>
<bind constraint="not(selected(., 'yes') and selected (., 'no'))" jr:constraintMsg="jr:itext('/xlsform_spec_test/everything/repeat_test/group_test/select_multiple_test:jr:constraintMsg')" nodeset="/xlsform_spec_test/everything/repeat_test/group_test/select_multiple_test" required="false()" type="string"/>
<bind nodeset="/xlsform_spec_test/everything/repeat_test/labeled_select_group/label-test" type="string"/>
<bind nodeset="/xlsform_spec_test/everything/repeat_test/labeled_select_group/list-nolabel-test" required="true()" type="string"/>
<bind nodeset="/xlsform_spec_test/everything/repeat_test/name/reserved_name_for_field_list_labels_25" type="string"/>
Expand Down

0 comments on commit 3723bb6

Please sign in to comment.