Skip to content

Commit f345911

Browse files
authored
Merge pull request #4788 from kobotoolbox/correct-instanceid-deprecatedid-confusion
Correctly use instanceID instead of deprecatedID
2 parents 7dddfac + 1831e27 commit f345911

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

kpi/deployment_backends/base_backend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class BaseDeploymentBackend(abc.ABC):
3939
]
4040

4141
# XPaths are relative to the root node
42-
SUBMISSION_UUID_XPATH = './meta/deprecatedID'
42+
SUBMISSION_CURRENT_UUID_XPATH = './meta/instanceID'
43+
SUBMISSION_DEPRECATED_UUID_XPATH = './meta/deprecatedID'
4344
FORM_UUID_XPATH = './formhub/uuid'
4445

4546
def __init__(self, asset):

kpi/deployment_backends/kobocat_backend.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,9 @@ def edit_submission(
539539
t('Your submission XML is malformed.')
540540
)
541541
try:
542-
deprecated_uuid = xml_root.find(self.SUBMISSION_UUID_XPATH).text
542+
deprecated_uuid = xml_root.find(
543+
self.SUBMISSION_DEPRECATED_UUID_XPATH
544+
).text
543545
xform_uuid = xml_root.find(self.FORM_UUID_XPATH).text
544546
except AttributeError:
545547
raise SubmissionIntegrityError(

kpi/tests/utils/mock.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from django.core.files import File
1212
from rest_framework import status
1313

14-
from kpi.deployment_backends.base_backend import BaseDeploymentBackend
1514
from kpi.mixins.audio_transcoding import AudioTranscodingMixin
1615
from kpi.models.asset_snapshot import AssetSnapshot
1716
from kpi.tests.utils.xml import get_form_and_submission_tag_names
@@ -70,10 +69,10 @@ def enketo_edit_instance_response_with_uuid_validation(request):
7069
submission = body['instance']
7170
submission_xml_root = lxml.etree.fromstring(submission)
7271
assert submission_xml_root.find(
73-
BaseDeploymentBackend.FORM_UUID_XPATH
72+
'./formhub/uuid'
7473
).text.strip()
7574
assert submission_xml_root.find(
76-
BaseDeploymentBackend.SUBMISSION_UUID_XPATH
75+
'./meta/instanceID'
7776
).text.strip()
7877

7978
resp_body = {

kpi/views/v2/data.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,14 +694,16 @@ def _get_enketo_link(
694694
)
695695
if (
696696
not (
697-
e := submission_xml_root.find(deployment.SUBMISSION_UUID_XPATH)
697+
e := submission_xml_root.find(
698+
deployment.SUBMISSION_CURRENT_UUID_XPATH
699+
)
698700
)
699701
or not e.text.strip()
700702
):
701703
edit_submission_xml(
702704
submission_xml_root,
703-
deployment.SUBMISSION_UUID_XPATH,
704-
'uuid:' + submission_json['_uuid']
705+
deployment.SUBMISSION_CURRENT_UUID_XPATH,
706+
'uuid:' + submission_json['_uuid'],
705707
)
706708

707709
# Do not use version_uid from the submission until UI gives users the

0 commit comments

Comments
 (0)