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

Adding Control Reference to Worksheet causes print fail #1474

Merged
merged 2 commits into from
Nov 22, 2019
Merged

Conversation

xispa
Copy link
Member

@xispa xispa commented Nov 22, 2019

Description of the issue/feature this PR addresses

Linked issue: #1431

Current behavior before PR

When a reference sample (e.g. control) is added to a Worksheet and the print button is pressed, the following error occurs:

Unable to load the template 'ar_by_column.pt':
Traceback (most recent call last):
  File "/usr/local/Plone/buildout-cache/eggs/senaite.core-1.3.1-py2.7.egg/bika/lims/browser/worksheet/views/printview.py", line 143, in renderWSTemplate
    reptemplate = embed(self)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.27-py2.7.egg/Products/Five/browser/pagetemplatefile.py", line 59, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File "/usr/local/Plone/buildout-cache/eggs/zope.pagetemplate-3.6.3-py2.7.egg/zope/pagetemplate/pagetemplate.py", line 132, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations
  File "/usr/local/Plone/buildout-cache/eggs/five.pt-2.2.4-py2.7.egg/five/pt/engine.py", line 98, in __call__
    return self.template.render(**kwargs)
  File "/usr/local/Plone/buildout-cache/eggs/z3c.pt-3.2.0-py2.7.egg/z3c/pt/pagetemplate.py", line 173, in render
    return base_renderer(**context)
  File "/usr/local/Plone/buildout-cache/eggs/Chameleon-3.6.2-py2.7.egg/chameleon/zpt/template.py", line 306, in render
    return super(PageTemplate, self).render(**_kw)
  File "/usr/local/Plone/buildout-cache/eggs/Chameleon-3.6.2-py2.7.egg/chameleon/template.py", line 209, in render
    raise_with_traceback(exc, tb)
  File "/usr/local/Plone/buildout-cache/eggs/Chameleon-3.6.2-py2.7.egg/chameleon/template.py", line 187, in render
    self._render(stream, econtext, rcontext)
  File "58de6ce66ce9364d2672247d11f82b6c.py", line 119, in render
  File "/usr/local/Plone/buildout-cache/eggs/senaite.core-1.3.1-py2.7.egg/bika/lims/browser/worksheet/views/printview.py", line 190, in getWorksheet
    ws = self._ws_data(self._worksheets[self._current_ws_index])
  File "/usr/local/Plone/buildout-cache/eggs/senaite.core-1.3.1-py2.7.egg/bika/lims/browser/worksheet/views/printview.py", line 253, in _ws_data
    data['ars'] = self._analyses_data(ws)
  File "/usr/local/Plone/buildout-cache/eggs/senaite.core-1.3.1-py2.7.egg/bika/lims/browser/worksheet/views/printview.py", line 375, in _analyses_data
    ar['sample'] = self._sample_data(an.getRequest())
AttributeError: getRequest

 - Expression: "python:view.getWorksheet()"
 - Filename:   ... owser/worksheet/views/../templates/print/ar_by_column.pt
 - Location:   (line 16: col 30)
 - Source:     ... ne="worksheet       python:view.getWorksheet();
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  repeat: {...} (0)
               template: 
               views: 
               modules: 
               args: 
               here: 
               wrapped_repeat: 
               user: 
               nothing: 
               container: 
               request: 
               traverse_subpath: 
               default: 
               context: 
               view: 
               translate: 
               root: 
               options: {...} (0)
               loop: {...} (0)
               target_language: 

Desired behavior after PR is merged

No traceback and the worksheet print view is rendered correctly

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

@xispa xispa added the Bug 🐞 label Nov 22, 2019
@xispa xispa requested a review from ramonski November 22, 2019 10:36
@ramonski ramonski merged commit aed9b71 into master Nov 22, 2019
@ramonski ramonski deleted the i1431 branch November 22, 2019 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants