Skip to content
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

Upgrade to pyxform 1.5.1 #716

Merged
merged 1 commit into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions onadata/apps/api/tests/fixtures/Transportation Form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>transportation_2011_07_25</h:title>
<model>
<model odk:xforms-version="1.0.0">
<instance>
<transportation_2011_07_25 id="transportation_2011_07_25">
<formhub>
Expand Down Expand Up @@ -46,18 +46,18 @@
</meta>
</transportation_2011_07_25>
</instance>
<bind nodeset="/transportation_2011_07_25/transport/available_transportation_types_to_referral_facility" type="select"/>
<bind nodeset="/transportation_2011_07_25/transport/available_transportation_types_to_referral_facility" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/available_transportation_types_to_referral_facility_other" relevant="selected(../available_transportation_types_to_referral_facility, 'other')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/ambulance/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'ambulance')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/bicycle/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'bicycle')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/boat_canoe/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'boat_canoe')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/bus/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'bus')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/donkey_mule_cart/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'donkey_mule_cart')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/keke_pepe/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'keke_pepe')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'lorry')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'motorbike')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'taxi')" type="select1"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/transportation_2011_07_25/meta/instanceID" readonly="true()" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/ambulance/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'ambulance')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/bicycle/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'bicycle')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/boat_canoe/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'boat_canoe')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/bus/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'bus')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/donkey_mule_cart/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'donkey_mule_cart')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/keke_pepe/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'keke_pepe')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'lorry')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'motorbike')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'taxi')" type="string"/>
<bind jr:preload="uid" nodeset="/transportation_2011_07_25/meta/instanceID" readonly="true()" type="string"/>
<bind calculate="'%(form_uuid)s'" nodeset="/transportation_2011_07_25/formhub/uuid" type="string"/>
</model>
</h:head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<bind nodeset="/contributions/age" type="int"/>
<bind nodeset="/contributions/amount" type="decimal"/>
<bind nodeset="/contributions/date_of_contribution" type="date"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/contributions/meta/instanceID" readonly="true()" type="string"/>
<bind jr:preload="uid" nodeset="/contributions/meta/instanceID" readonly="true()" type="string"/>
<bind calculate="'e24036d80c0644a9b5674178892d6b6f'" nodeset="/contributions/formhub/uuid" type="string"/>
</model>
</h:head>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
<bind nodeset="/new_cascading_select/state" type="select1"/>
<bind nodeset="/new_cascading_select/county" type="select1"/>
<bind nodeset="/new_cascading_select/city" type="select1"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/new_cascading_select/meta/instanceID" readonly="true()" type="string"/>
<bind jr:preload="uid" nodeset="/new_cascading_select/meta/instanceID" readonly="true()" type="string"/>
</model>
</h:head>
<h:body>
Expand Down
2 changes: 1 addition & 1 deletion onadata/apps/main/tests/fixtures/exp_line_break.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<bind nodeset="/exp_line_break/photo" type="binary"/>
<bind nodeset="/exp_line_break/kind" type="select1"/>
<bind nodeset="/exp_line_break/required" required="true()" type="select1"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/exp_line_break/meta/instanceID" readonly="true()" type="string"/>
<bind jr:preload="uid" nodeset="/exp_line_break/meta/instanceID" readonly="true()" type="string"/>
<bind calculate="'663123a849e54bffa8f9832ef016bfac'" nodeset="/exp_line_break/formhub/uuid" type="string"/>
</model>
</h:head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'lorry')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'motorbike')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'taxi')" type="select1"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/transportation/meta/instanceID" readonly="true()" type="string"/>
<bind jr:preload="uid" nodeset="/transportation/meta/instanceID" readonly="true()" type="string"/>
<bind calculate="''" nodeset="/transportation/formhub/uuid" type="string" />
</model>
</h:head>
Expand Down
24 changes: 12 additions & 12 deletions onadata/apps/main/tests/fixtures/transportation/transportation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>transportation_2011_07_25</h:title>
<model>
<model odk:xforms-version="1.0.0">
<instance>
<transportation_2011_07_25 id="transportation_2011_07_25">
<formhub>
Expand Down Expand Up @@ -46,18 +46,18 @@
</meta>
</transportation_2011_07_25>
</instance>
<bind nodeset="/transportation_2011_07_25/transport/available_transportation_types_to_referral_facility" type="select"/>
<bind nodeset="/transportation_2011_07_25/transport/available_transportation_types_to_referral_facility" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/available_transportation_types_to_referral_facility_other" relevant="selected(../available_transportation_types_to_referral_facility, 'other')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/ambulance/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'ambulance')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/bicycle/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'bicycle')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/boat_canoe/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'boat_canoe')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/bus/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'bus')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/donkey_mule_cart/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'donkey_mule_cart')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/keke_pepe/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'keke_pepe')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'lorry')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'motorbike')" type="select1"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'taxi')" type="select1"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/transportation_2011_07_25/meta/instanceID" readonly="true()" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/ambulance/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'ambulance')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/bicycle/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'bicycle')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/boat_canoe/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'boat_canoe')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/bus/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'bus')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/donkey_mule_cart/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'donkey_mule_cart')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/keke_pepe/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'keke_pepe')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'lorry')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'motorbike')" type="string"/>
<bind nodeset="/transportation_2011_07_25/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility" relevant="selected( /transportation_2011_07_25/transport/available_transportation_types_to_referral_facility , 'taxi')" type="string"/>
<bind jr:preload="uid" nodeset="/transportation_2011_07_25/meta/instanceID" readonly="true()" type="string"/>
<bind calculate="''" nodeset="/transportation_2011_07_25/formhub/uuid" type="string" />
</model>
</h:head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility" relevant="selected(/transportation/transport/available_transportation_types_to_referral_facility, 'lorry')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility" relevant="selected(/transportation/transport/available_transportation_types_to_referral_facility, 'motorbike')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility" relevant="selected(/transportation/transport/available_transportation_types_to_referral_facility, 'taxi')" type="select1"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/transportation/meta/instanceID" readonly="true()" type="string"/>
<bind jr:preload="uid" nodeset="/transportation/meta/instanceID" readonly="true()" type="string"/>
</model>
</h:head>
<h:body>
Expand Down
2 changes: 1 addition & 1 deletion onadata/apps/main/tests/test_past_bugs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_uniqueness_of_group_names_enforced(self):
self._create_user_and_login()
response = self._publish_xls_file(
'fixtures/group_names_must_be_unique.xls')
message = 'There are two sections with the name group_names_must_be_unique.'
message = 'The name "group_names_must_be_unique" is the same as the form name'
response_content = smart_text(response.content)
self.assertTrue(message in response_content)
self.assertEqual(XForm.objects.count(), pre_count)
Expand Down
9 changes: 4 additions & 5 deletions onadata/apps/viewer/pandas_mongo_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
except ImportError:
from pandas import ExcelWriter

from pyxform.constants import SELECT_ALL_THAT_APPLY
from pyxform.survey_element import SurveyElement
from pyxform.section import Section, RepeatingSection
from pyxform.question import Question
Expand Down Expand Up @@ -40,8 +41,6 @@
# this is Mongo Collection where we will store the parsed submissions
xform_instances = settings.MONGO_DB.instances

# the bind type of select multiples that we use to compare
MULTIPLE_SELECT_BIND_TYPE = "select"
GEOPOINT_BIND_TYPE = "geopoint"

# column group delimiters
Expand Down Expand Up @@ -123,7 +122,7 @@ def _collect_select_multiples(cls, dd):
return dict([(e.get_abbreviated_xpath(), [c.get_abbreviated_xpath()
for c in e.children])
for e in dd.get_survey_elements()
if e.bind.get("type") == "select"])
if e.type == SELECT_ALL_THAT_APPLY])

@classmethod
def _split_select_multiples(cls, record, select_multiples,
Expand Down Expand Up @@ -438,9 +437,9 @@ def _build_sections_recursive(self, section_name, element,
child_bind_type = child.bind.get("type")
if isinstance(child, Question) and not \
question_types_to_exclude(child.type)\
and not child_bind_type == MULTIPLE_SELECT_BIND_TYPE:
and not child.type == SELECT_ALL_THAT_APPLY:
self._add_column_to_section(section_name, child)
elif child_bind_type == MULTIPLE_SELECT_BIND_TYPE:
elif child.type == SELECT_ALL_THAT_APPLY:
self.select_multiples[child.get_abbreviated_xpath()] = \
[option.get_abbreviated_xpath()
for option in child.children]
Expand Down
Loading