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

Fix APIError: Expected string type in samples listing #116

Merged
merged 2 commits into from
Oct 30, 2024
Merged

Conversation

xispa
Copy link
Member

@xispa xispa commented Oct 30, 2024

Description of the issue/feature this PR addresses

This Pull Request fixes a traceback that arises in samples listing when the sample does not have a MRN value set. Note getMedicalRecordNumberValue accessor returns None if there is no value set for the field.

Current behavior before PR

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 176, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 385, in publish_module
  Module ZPublisher.WSGIPublisher, line 288, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module senaite.app.listing.view, line 246, in __call__
  Module senaite.app.listing.ajax, line 113, in handle_subpath
  Module senaite.core.decorators, line 40, in decorator
  Module senaite.app.listing.decorators, line 63, in wrapper
  Module senaite.app.listing.decorators, line 50, in wrapper
  Module senaite.app.listing.decorators, line 100, in wrapper
  Module senaite.app.listing.ajax, line 383, in ajax_folderitems
  Module senaite.app.listing.decorators, line 88, in wrapper
  Module senaite.app.listing.ajax, line 259, in get_folderitems
  Module senaite.app.listing.view, line 988, in folderitems
  Module senaite.patient, line 56, in wrapper
  Module senaite.patient.adapters.listing, line 108, in folder_item
  Module bika.lims.api, line 1949, in to_utf8
  Module bika.lims.api, line 477, in fail
APIError: Expected string type, got '<type 'NoneType'>'

Desired behavior after PR is merged

No error in samples listing

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

xispa added 2 commits October 30, 2024 12:21
```
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 176, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 385, in publish_module
  Module ZPublisher.WSGIPublisher, line 288, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module senaite.app.listing.view, line 246, in __call__
  Module senaite.app.listing.ajax, line 113, in handle_subpath
  Module senaite.core.decorators, line 40, in decorator
  Module senaite.app.listing.decorators, line 63, in wrapper
  Module senaite.app.listing.decorators, line 50, in wrapper
  Module senaite.app.listing.decorators, line 100, in wrapper
  Module senaite.app.listing.ajax, line 383, in ajax_folderitems
  Module senaite.app.listing.decorators, line 88, in wrapper
  Module senaite.app.listing.ajax, line 259, in get_folderitems
  Module senaite.app.listing.view, line 988, in folderitems
  Module senaite.patient, line 56, in wrapper
  Module senaite.patient.adapters.listing, line 108, in folder_item
  Module bika.lims.api, line 1949, in to_utf8
  Module bika.lims.api, line 477, in fail
APIError: Expected string type, got '<type 'NoneType'>'
```
@xispa xispa requested a review from ramonski October 30, 2024 11:31
@xispa xispa added the bug Something isn't working label Oct 30, 2024
@ramonski ramonski merged commit 3709228 into master Oct 30, 2024
2 checks passed
@ramonski ramonski deleted the fix-api-error branch October 30, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants