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

Error when viewing a Sample w/o Batch as client contact #1510

Merged
merged 3 commits into from
Jan 28, 2020

Conversation

xispa
Copy link
Member

@xispa xispa commented Jan 27, 2020

Description of the issue/feature this PR addresses

Error arises in Sample View when the sample does not have a Batch assigned and current user is a client contact.

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 bika.lims.browser.analysisrequest.view, line 62, in __call__
  Module bika.lims.browser.header_table, line 83, in __call__
  Module Products.Five.browser.pagetemplatefile, line 125, in __call__
  Module Products.Five.browser.pagetemplatefile, line 59, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module five.pt.engine, line 98, in __call__
  Module z3c.pt.pagetemplate, line 173, in render
  Module chameleon.zpt.template, line 306, in render
  Module chameleon.template, line 209, in render
  Module chameleon.template, line 187, in render
  Module 64a1bd307477a7bad19adec76209dda5.py, line 186, in render
  Module bika.lims.browser.header_table, line 274, in
get_fields_grouped_by_location
  Module bika.lims.browser.header_table, line 260, in get_field_visibility_mode
  Module bika.lims.monkey.Widget, line 75, in isVisible
  Module bika.lims.adapters.widgetvisibility, line 44, in __call__
  Module bika.lims.adapters.widgetvisibility, line 109, in isVisible
AttributeError: 'NoneType' object has no attribute 'getClient'

 - Expression: "python:view.get_fields_grouped_by_location()"
 - Filename:   ... senaite.core/bika/lims/browser/templates/header_table.pt
 - Location:   (line 15: col 22)
 - Source:     ... ine="dummy python:view.get_fields_grouped_by_location();
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  repeat: {...} (0)
               template: <ViewPageTemplateFile - at 0x7f65c3927e90>
               views: <ViewMapper - at 0x7f65c1c7e6d0>
               modules: <instance - at 0x7f65d616dcf8>
               args: <tuple - at 0x7f65d8559050>
               here: <ImplicitAcquisitionWrapper H2O-0008 at 0x7f65c2c58460>
               wrapped_repeat: <SafeMapping - at 0x7f65c2d9cfc8>
               user: <ImplicitAcquisitionWrapper - at 0x7f65c2c58d20>
               nothing: <NoneType - at 0x557afb93b1a0>
               container: <ImplicitAcquisitionWrapper H2O-0008 at
0x7f65c2c58460>
               request: <instance - at 0x7f65c92c5e18>
               traverse_subpath: <list - at 0x7f65c9b323f8>
               default: <object - at 0x7f65d852fbf0>
               context: <ImplicitAcquisitionWrapper H2O-0008 at 0x7f65c2c58460>
               view: <HeaderTableView None at 0x7f65c1c7e250>
               translate: <function translate at 0x7f65c20e7140>
               root: <ImplicitAcquisitionWrapper Zope at 0x7f65c26677d0>
               options: {...} (0)
               loop: {...} (0)
               target_language: en

Current behavior before PR

Error in sample view when current user is a client contact and sample has no batch assigned

Desired behavior after PR is merged

No traceback

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

xispa added 2 commits January 27, 2020 17:46
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 bika.lims.browser.analysisrequest.view, line 62, in __call__
  Module bika.lims.browser.header_table, line 83, in __call__
  Module Products.Five.browser.pagetemplatefile, line 125, in __call__
  Module Products.Five.browser.pagetemplatefile, line 59, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module five.pt.engine, line 98, in __call__
  Module z3c.pt.pagetemplate, line 173, in render
  Module chameleon.zpt.template, line 306, in render
  Module chameleon.template, line 209, in render
  Module chameleon.template, line 187, in render
  Module 64a1bd307477a7bad19adec76209dda5.py, line 186, in render
  Module bika.lims.browser.header_table, line 274, in
get_fields_grouped_by_location
  Module bika.lims.browser.header_table, line 260, in get_field_visibility_mode
  Module bika.lims.monkey.Widget, line 75, in isVisible
  Module bika.lims.adapters.widgetvisibility, line 44, in __call__
  Module bika.lims.adapters.widgetvisibility, line 109, in isVisible
AttributeError: 'NoneType' object has no attribute 'getClient'

 - Expression: "python:view.get_fields_grouped_by_location()"
 - Filename:   ... senaite.core/bika/lims/browser/templates/header_table.pt
 - Location:   (line 15: col 22)
 - Source:     ... ine="dummy python:view.get_fields_grouped_by_location();
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  repeat: {...} (0)
               template: <ViewPageTemplateFile - at 0x7f65c3927e90>
               views: <ViewMapper - at 0x7f65c1c7e6d0>
               modules: <instance - at 0x7f65d616dcf8>
               args: <tuple - at 0x7f65d8559050>
               here: <ImplicitAcquisitionWrapper H2O-0008 at 0x7f65c2c58460>
               wrapped_repeat: <SafeMapping - at 0x7f65c2d9cfc8>
               user: <ImplicitAcquisitionWrapper - at 0x7f65c2c58d20>
               nothing: <NoneType - at 0x557afb93b1a0>
               container: <ImplicitAcquisitionWrapper H2O-0008 at
0x7f65c2c58460>
               request: <instance - at 0x7f65c92c5e18>
               traverse_subpath: <list - at 0x7f65c9b323f8>
               default: <object - at 0x7f65d852fbf0>
               context: <ImplicitAcquisitionWrapper H2O-0008 at 0x7f65c2c58460>
               view: <HeaderTableView None at 0x7f65c1c7e250>
               translate: <function translate at 0x7f65c20e7140>
               root: <ImplicitAcquisitionWrapper Zope at 0x7f65c26677d0>
               options: {...} (0)
               loop: {...} (0)
               target_language: en
@ramonski ramonski merged commit 3c757d5 into master Jan 28, 2020
@ramonski ramonski deleted the error-access-sample branch January 28, 2020 08:00
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