Error when printing worksheets


#1

Dear community,
when hitting the “print” button from a created worksheet that has 4 samples assigned, the following error occurs:

WS-001 - Unable to load the template ‘ar_by_column.pt’:

Traceback (most recent call last):
File “/home/senaite/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 “/home/senaite/buildout-cache/eggs/Zope2-2.13.28-py2.7.egg/Products/Five/browser/pagetemplatefile.py”, line 59, in call
sourceAnnotations=getattr(debug_flags, ‘sourceAnnotations’, 0),
File “/home/senaite/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 “/home/senaite/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 “/home/senaite/buildout-cache/eggs/z3c.pt-3.2.0-py2.7.egg/z3c/pt/pagetemplate.py”, line 173, in render
return base_renderer(context)
File “/home/senaite/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 “/home/senaite/buildout-cache/eggs/Chameleon-3.6.2-py2.7.egg/chameleon/template.py”, line 209, in render
raise_with_traceback(exc, tb)
File “/home/senaite/buildout-cache/eggs/Chameleon-3.6.2-py2.7.egg/chameleon/template.py”, line 187, in render
self._render(stream, econtext, rcontext)
File “bc6147be19d9d4a62da071e4b4e4f4b8.py”, line 119, in render
File “/home/senaite/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 “/home/senaite/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 “/home/senaite/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 14: col 60)
  • Source: … efine="worksheet python:view.getWorksheet(); laboratory work …
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  • 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:

The file “ar_by_column.pt” resides in the folder

/home/senaite/buildout-cache/eggs/senaite.core-1.3.1-py2.7.egg/bika/lims/browser/worksheet/templates/print

Selecting “ar_by_row.pt” gives a similar error.

Is this the expected behaviour?
What can be done to cure this?

Thanks,
Andreas


#2

Maybe wrong file permissions?
In my installation they look like this:

senaite :: ~ » ll /home/senaite/senaitelims/src/senaite.core/bika/lims/browser/worksheet/templates/print/
total 44K
drwxrwxr-x 2 senaite senaite 4.0K Mar 18 2019 .
drwxrwxr-x 3 senaite senaite 4.0K Mar 18 2019 …
-rw-rw-r-- 1 senaite senaite 2.0K Jul 17 2018 ar_by_column.css
-rw-rw-r-- 1 senaite senaite 5.0K Jul 17 2018 ar_by_column.pt
-rw-rw-r-- 1 senaite senaite 1.9K Jul 17 2018 ar_by_row.css
-rw-rw-r-- 1 senaite senaite 4.1K Jul 17 2018 ar_by_row.pt
-rw-rw-r-- 1 senaite senaite 8.1K Mar 18 2019 README.rst


#3

I don’t know, what caused this issue.
A reinstall, however cured the problem and printing worksheets is possible now.

Thanks.


#4

After entry of a measuring device, supplier, reference definition and reference sample (QC sample) the error is back again:

WS-001 - Unable to load the template 'ar_by_column.pt:
 Traceback (most recent call last):
  File "/home/senaite/senaitelims/src/senaite.core/bika/lims/browser/worksheet/views/printview.py", line 143, in renderWSTemplate
    reptemplate = embed(self)
  File "/home/senaite/buildout-cache/eggs/Zope2-2.13.29-py2.7.egg/Products/Five/browser/pagetemplatefile.py", line 59, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File "/home/senaite/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 "/home/senaite/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 "/home/senaite/buildout-cache/eggs/z3c.pt-3.2.0-py2.7.egg/z3c/pt/pagetemplate.py", line 173, in render
    return base_renderer(**context)
  File "/home/senaite/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 "/home/senaite/buildout-cache/eggs/Chameleon-3.6.2-py2.7.egg/chameleon/template.py", line 209, in render
    raise_with_traceback(exc, tb)
  File "/home/senaite/buildout-cache/eggs/Chameleon-3.6.2-py2.7.egg/chameleon/template.py", line 187, in render
    self._render(stream, econtext, rcontext)
  File "59a85fb829b45b5be2800253707bd225.py", line 119, in render
  File "/home/senaite/senaitelims/src/senaite.core/bika/lims/browser/worksheet/views/printview.py", line 190, in getWorksheet
    ws = self._ws_data(self._worksheets[self._current_ws_index])
  File "/home/senaite/senaitelims/src/senaite.core/bika/lims/browser/worksheet/views/printview.py", line 253, in _ws_data
    data['ars'] = self._analyses_data(ws)
  File "/home/senaite/senaitelims/src/senaite.core/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: 

And as stated above: The template is obviously there.
So I don’t know why the server can’t find it.

Any clues anyone?

Thanks.


#5

To nail it down a little bit more:
I can print a worksheet with samples/analyses assigned:

But as soon as I add a reference sample (QC sample), I get the error again:

WS-002 - Unable to load the template ‘ar_by_column.pt’:

Traceback (most recent call last):
File “/home/senaite/senaitelims/src/senaite.core/bika/lims/browser/worksheet/views/printview.py”, line 143, in renderWSTemplate
reptemplate = embed(self)
File “/home/senaite/buildout-cache/eggs/Zope2-2.13.29-py2.7.egg/Products/Five/browser/pagetemplatefile.py”, line 59, in call
sourceAnnotations=getattr(debug_flags, ‘sourceAnnotations’, 0),
File “/home/senaite/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 “/home/senaite/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 “/home/senaite/buildout-cache/eggs/z3c.pt-3.2.0-py2.7.egg/z3c/pt/pagetemplate.py”, line 173, in render
return base_renderer(context)
File “/home/senaite/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 “/home/senaite/buildout-cache/eggs/Chameleon-3.6.2-py2.7.egg/chameleon/template.py”, line 209, in render
raise_with_traceback(exc, tb)
File “/home/senaite/buildout-cache/eggs/Chameleon-3.6.2-py2.7.egg/chameleon/template.py”, line 187, in render
self._render(stream, econtext, rcontext)
File “59a85fb829b45b5be2800253707bd225.py”, line 119, in render
File “/home/senaite/senaitelims/src/senaite.core/bika/lims/browser/worksheet/views/printview.py”, line 190, in getWorksheet
ws = self._ws_data(self._worksheets[self._current_ws_index])
File “/home/senaite/senaitelims/src/senaite.core/bika/lims/browser/worksheet/views/printview.py”, line 253, in _ws_data
data[‘ars’] = self._analyses_data(ws)
File “/home/senaite/senaitelims/src/senaite.core/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:

What can I do to get around this error?

Thanks.


#6

It would have saved me some time, if someone told me that this was a known bug:
https://github.com/senaite/senaite.core/issues/1431

However, is there a Senaite Version, that does not suffer from this bug?

Thanks.