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

AttributeError: OsmUploadQuestion includes SELECT_QUESTION_EXTRA_FIELDS #752

Open
ukanga opened this issue Jan 28, 2025 · 1 comment
Open

Comments

@ukanga
Copy link
Contributor

ukanga commented Jan 28, 2025

The OSMUploadQuestion includes SELECT_QUESTION_EXTRA_FIELDS which results in an exception when calling the to_json_dict() function for the question. This raises AttributeError exception.

python -m unittest tests.test_osm                                                                                               (pyxform)  ✘ 1 master ✱
.E.
======================================================================
ERROR: test_osm_type_to_json_dict (tests.test_osm.OSMWidgetsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ukanga/ona/pyxform/tests/test_osm.py", line 64, in test_osm_type_to_json_dict
    self.assertEqual(osm_question.to_json_dict(), {})
  File "/home/ukanga/ona/pyxform/pyxform/question.py", line 234, in to_json_dict
    result = super().to_json_dict(delete_keys=to_delete)
  File "/home/ukanga/ona/pyxform/pyxform/survey_element.py", line 284, in to_json_dict
    result = self.copy()
  File "/home/ukanga/ona/pyxform/pyxform/survey_element.py", line 276, in copy
    return {k: self[k] for k in self}
  File "/home/ukanga/ona/pyxform/pyxform/survey_element.py", line 276, in <dictcomp>
    return {k: self[k] for k in self}
  File "/home/ukanga/ona/pyxform/pyxform/survey_element.py", line 54, in __getitem__
    return self.__getattribute__(key)
AttributeError: 'OsmUploadQuestion' object has no attribute 'itemset'

----------------------------------------------------------------------
Ran 3 tests in 0.005s

FAILED (errors=1)

This line might be including a typo. I believe what was meant was to use OSM_QUESTION_EXTRA_FIELDS.

@ukanga
Copy link
Contributor Author

ukanga commented Jan 28, 2025

Perhaps not necessary due to the discussion to deprecate the functionality - #745.

ukanga added a commit to onaio/pyxform that referenced this issue Jan 28, 2025
ukanga added a commit to onaio/pyxform that referenced this issue Jan 28, 2025
ukanga added a commit to onaio/pyxform that referenced this issue Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant