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 KeyError in Sample Type Listing #1494

Merged
merged 2 commits into from
Dec 22, 2019
Merged

Conversation

ramonski
Copy link
Contributor

Description of the issue/feature this PR addresses

This PR fixes a KeyError when some subfields of the retention period are omitted.

Traceback:

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module senaite.core.listing.view, line 222, in __call__
  Module senaite.core.listing.ajax, line 101, in handle_subpath
  Module senaite.core.listing.decorators, line 63, in wrapper
  Module senaite.core.listing.decorators, line 50, in wrapper
  Module senaite.core.listing.decorators, line 100, in wrapper
  Module senaite.core.listing.ajax, line 533, in ajax_folderitems
  Module senaite.core.listing.decorators, line 88, in wrapper
  Module senaite.core.listing.ajax, line 305, in get_folderitems
  Module senaite.core.listing.view, line 837, in folderitems
  Module bika.lims, line 224, in wrapper
  Module senaite.core.listing.view, line 1143, in _folderitems
  Module bika.lims.controlpanel.bika_sampletypes, line 157, in folderitem
KeyError: 'minutes'

Current behavior before PR

Traceback occurs when not all values of the retention period were set

Desired behavior after PR is merged

No traceback happens and omitted fields default to 0

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

Fix KeyError when some subfields of the retention period are omitted.

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module senaite.core.listing.view, line 222, in __call__
  Module senaite.core.listing.ajax, line 101, in handle_subpath
  Module senaite.core.listing.decorators, line 63, in wrapper
  Module senaite.core.listing.decorators, line 50, in wrapper
  Module senaite.core.listing.decorators, line 100, in wrapper
  Module senaite.core.listing.ajax, line 533, in ajax_folderitems
  Module senaite.core.listing.decorators, line 88, in wrapper
  Module senaite.core.listing.ajax, line 305, in get_folderitems
  Module senaite.core.listing.view, line 837, in folderitems
  Module bika.lims, line 224, in wrapper
  Module senaite.core.listing.view, line 1143, in _folderitems
  Module bika.lims.controlpanel.bika_sampletypes, line 157, in folderitem
KeyError: 'minutes'
@xispa xispa merged commit 2280ab1 into master Dec 22, 2019
@xispa xispa deleted the fix-keyerror-in-sampletype-listing branch December 22, 2019 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants