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

Publication preference missing and publication error in senaite #66

Closed
siyamalan opened this issue Apr 7, 2019 · 9 comments

Comments

3 participants
@siyamalan
Copy link

commented Apr 7, 2019

-- Steps to reproduce
Added a Client and added contacts under it
-- Current behavior
Edited a contact to set publication preference. Not seeing any pdf/print options under publications preference
-- Expected behavior
Should be able to see options under publication preference
-- Screenshot (optional)
image

Clicking Prepublish or Publish button results in below error because of this
image

@siyamalan

This comment has been minimized.

Copy link
Author

commented Apr 8, 2019

This doesn’t look like a senaite.impress related bug. Everything working correctly with senaite.core 1.2.9 , senaite.lims 1.2.2, plone 4.3.18, senaite.impress 1.0.2 combo.

@xispa

This comment has been minimized.

Copy link
Contributor

commented Apr 8, 2019

This is a bug in senaite.impress's default template. Classic publication preferences are no longer available, cause the new reporting machinery allows to either send an email (with or without the report attached) to multiple addresses or generate the results report PDF without sending any notification.

@xispa xispa transferred this issue from senaite/senaite.lims Apr 8, 2019

ramonski added a commit that referenced this issue Apr 8, 2019

Fix PublicationPreference Traceback in Default template (#67)
## Description of the issue/feature this PR addresses

Traceback is rised when Default template is selected in report preview.

#66

## Current behavior before PR

```
Error: PublicationPreference

 - Expression: "python:contact and contact.PublicationPreference != '' and 'email' in contact.PublicationPreference"
 - Filename:   ... impress/src/senaite/impress/templates/reports/Default.pt
 - Location:   (line 627: col 28)
 - Source:     ... python:contact and contact.PublicationPreference != '' and 'email' in contact.PublicationPreference ...
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  page_width: 210.0
               request: <instance - at 0x7f99e1661f38>
               laboratory: <SuperModel - at 0x7f99de5d3710>
               content_height: 257.0
               container: <ImplicitAcquisitionWrapper senaite at 0x7f99e1efdd20>
               wrapped_repeat: <SafeMapping - at 0x7f99de41ce10>
               accredited_symbol: ★
               contact: <SuperModel - at 0x7f99dfa389d0>
               traverse_subpath: <list - at 0x7f99df62a6c8>
               content_width: 170.0
               template: <ViewPageTemplateFile - at 0x7f99df5fac90>
               report_options: {...} (1)
               translate: <function translate at 0x7f99df2d5a28>
               repeat: {...} (0)
               views: <ViewMapper - at 0x7f99df5fa3d0>
               args: <tuple - at 0x7f99fde96050>
               here: <ImplicitAcquisitionWrapper senaite at 0x7f99e1efdd20>
               attachments_per_row: 2
               user: <ImplicitAcquisitionWrapper - at 0x7f99e1ab15a0>
               nothing: <NoneType - at 0x935be0>
               page_height: 297.0
               footer: 
               default: <object - at 0x7f99fddaf4f0>
               modules: <instance - at 0x7f99f6331290>
               client: <SuperModel - at 0x7f99dfa38cd0>
               outofrange_symbol: ⚠
               context: <ImplicitAcquisitionWrapper senaite at 0x7f99e1efdd20>
               model: <SuperModel - at 0x7f99df84a450>
               target_language: en
               root: <ImplicitAcquisitionWrapper Zope at 0x7f99df5f4fa0>
               options: {...} (12)
               loop: {...} (4)
               view: <LocationProxy None at 0x7f99df1b5128>
```

## Desired behavior after PR is merged

Report template is rendered correctly without traceback

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

[1]: https://www.python.org/dev/peps/pep-0008
[2]: https://docs.plone.org/develop/styleguide/python.html

@ramonski ramonski changed the title Publication preference missing and publication error in senatie Publication preference missing and publication error in senaite Apr 8, 2019

@ramonski ramonski closed this Apr 8, 2019

@siyamalan

This comment has been minimized.

Copy link
Author

commented Apr 9, 2019

couldn't get it work using development eggs

$ git clone git://github.com/plone/senaite.impress.git
[buildout]
eggs =
senaite.impress
develop =
    src/senaite.impress

hopefully this modified version will be soon uploaded to https://pypi.org/project/senaite.impress/

@ramonski

This comment has been minimized.

Copy link
Contributor

commented Apr 9, 2019

Can you please check the git log of this repo to return this:

$ cd src/senaite.impress
$ git log --oneline -1
c958dbd (HEAD -> master, origin/master, origin/HEAD) Fix PublicationPreference Traceback in Default template (#67)

Also make sure that you have run bin/buildout.

@siyamalan

This comment has been minimized.

Copy link
Author

commented Apr 9, 2019

Yep
image

@ramonski

This comment has been minimized.

Copy link
Contributor

commented Apr 9, 2019

And you've ran bin/buildout, so that your instance script shows something like this:

#!/Users/rbartl/miniconda2/envs/senaite.lims/bin/python

import sys
sys.path[0:0] = [
  '/Users/rbartl/develop/ridingbytes/senaite/senaite.lims/src',
  '/Users/rbartl/develop/ridingbytes/senaite/senaite.lims/src/senaite.impress/src',
...

Did you restart your instances as well? Maybe it is just a caching issue and you have to flush your browser cache

@siyamalan

This comment has been minimized.

Copy link
Author

commented Apr 10, 2019

No luck. I will do a another installation and try again.

Have a quick question for you.
I can see that you removed below lines from impress/src/senaite/impress/templates/reports/Default.pt to fix Error: PublicationPreference
<div class="discreeter-linkage" tal:condition="python:contact and contact.PublicationPreference != '' and 'email' in contact.PublicationPreference" i18n:translate=""> Methods of analysis available by clicking on the 'Request' link </div>
using a different template should bypass this problem right?
eg default.pt or MultiDefault.pt or MultidefaultbyColumn

  1. Using default.pt template casues
Error: ({}, 'address')

 - Expression: "laboratory/PhysicalAddress/address"
 - Filename:   ... 0-py2.7.egg/senaite/impress/templates/reports/Default.pt
 - Location:   (line 651: col 35)
 - Source:     ... tal:content="laboratory/PhysicalAddress/address">Lab Street ...
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  page_width: 210.0
               request: <instance - at 0x7ff16cbf8ef0>
               laboratory: <SuperModel - at 0x7ff16cfde0d0>
               content_height: 257.0
               container: <ImplicitAcquisitionWrapper lims at 0x7ff17079d230>
               wrapped_repeat: <SafeMapping - at 0x7ff16e0c4c58>
               accredited_symbol: ★
               contact: <SuperModel - at 0x7ff16d59af50>
               traverse_subpath: <list - at 0x7ff16d84b638>
               content_width: 170.0
               template: <ViewPageTemplateFile - at 0x7ff16d4f3a90>
               report_options: {...} (1)
               translate: <function translate at 0x7ff16da636e0>
               repeat: {...} (0)
               views: <ViewMapper - at 0x7ff16d4f3cd0>
               args: <tuple - at 0x7ff192825050>
               here: <ImplicitAcquisitionWrapper lims at 0x7ff17079d230>
               attachments_per_row: 2
               user: <ImplicitAcquisitionWrapper - at 0x7ff16df0f460>
               nothing: <NoneType - at 0x559fd9cc0ae0>
               page_height: 297.0
               footer: 
               default: <object - at 0x7ff1927fbc00>
               modules: <instance - at 0x7ff188125cb0>
               client: <SuperModel - at 0x7ff16d9e7b10>
               outofrange_symbol: ⚠
               context: <ImplicitAcquisitionWrapper lims at 0x7ff17079d230>
               model: <SuperModel - at 0x7ff16d4f3450>
               target_language: <NoneType - at 0x559fd9cc0ae0>
               root: <ImplicitAcquisitionWrapper Zope at 0x7ff17079deb0>
               options: {...} (12)
               loop: {...} (4)
               view: <LocationProxy None at 0x7ff16d84b170>
  1. Using MultiDefault.pt causes
Error: ({}, 'address')

 - Expression: "laboratory/PhysicalAddress/address"
 - Filename:   ... .7.egg/senaite/impress/templates/reports/MultiDefault.pt
 - Location:   (line 678: col 35)
 - Source:     ... tal:content="laboratory/PhysicalAddress/address">Lab Street ...
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  page_width: 210.0
               request: <instance - at 0x7ff16d84d950>
               laboratory: <SuperModel - at 0x7ff16d933150>
               content_height: 257.0
               container: <ImplicitAcquisitionWrapper lims at 0x7ff17263e910>
               wrapped_repeat: <SafeMapping - at 0x7ff16d8a4c58>
               accredited_symbol: ★
               traverse_subpath: <list - at 0x7ff16d84ddd0>
               content_width: 170.0
               template: <ViewPageTemplateFile - at 0x7ff16d663bd0>
               report_options: {...} (1)
               translate: <function translate at 0x7ff16d69f5f0>
               repeat: {...} (0)
               views: <ViewMapper - at 0x7ff16d6636d0>
               args: <tuple - at 0x7ff192825050>
               here: <ImplicitAcquisitionWrapper lims at 0x7ff17263e910>
               attachments_per_row: 2
               user: <ImplicitAcquisitionWrapper - at 0x7ff170806190>
               nothing: <NoneType - at 0x559fd9cc0ae0>
               page_height: 297.0
               footer: 
               default: <object - at 0x7ff1927fbc00>
               modules: <instance - at 0x7ff188125cb0>
               outofrange_symbol: ⚠
               context: <ImplicitAcquisitionWrapper lims at 0x7ff17263e910>
               collection: <list - at 0x7ff16d4bd4d0>
               target_language: <NoneType - at 0x559fd9cc0ae0>
               root: <ImplicitAcquisitionWrapper Zope at 0x7ff17160f3c0>
               options: {...} (12)
               loop: {...} (5)
               view: <LocationProxy None at 0x7ff16d4bd200>
  1. MultidefaultbyColumn
Error: ({}, 'address')

 - Expression: "laboratory/PhysicalAddress/address"
 - Filename:   ... enaite/impress/templates/reports/MultiDefaultByColumn.pt
 - Location:   (line 599: col 35)
 - Source:     ... tal:content="laboratory/PhysicalAddress/address">Lab Street ...
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  page_width: 210.0
               request: <instance - at 0x7ff16d6f92d8>
               laboratory: <SuperModel - at 0x7ff16d6d4090>
               content_height: 257.0
               container: <ImplicitAcquisitionWrapper lims at 0x7ff1704cf0a0>
               wrapped_repeat: <SafeMapping - at 0x7ff187708c00>
               accredited_symbol: ★
               traverse_subpath: <list - at 0x7ff16d6f15a8>
               content_width: 170.0
               template: <ViewPageTemplateFile - at 0x7ff16d8fc510>
               report_options: {...} (1)
               translate: <function translate at 0x7ff16d69f6e0>
               repeat: {...} (0)
               views: <ViewMapper - at 0x7ff16d8fce10>
               args: <tuple - at 0x7ff192825050>
               here: <ImplicitAcquisitionWrapper lims at 0x7ff1704cf0a0>
               attachments_per_row: 2
               user: <ImplicitAcquisitionWrapper - at 0x7ff170788f00>
               nothing: <NoneType - at 0x559fd9cc0ae0>
               page_height: 297.0
               footer: 
               default: <object - at 0x7ff1927fbc00>
               modules: <instance - at 0x7ff188125cb0>
               outofrange_symbol: ⚠
               context: <ImplicitAcquisitionWrapper lims at 0x7ff1704cf0a0>
               collection: <list - at 0x7ff16d6f1a70>
               target_language: <NoneType - at 0x559fd9cc0ae0>
               root: <ImplicitAcquisitionWrapper Zope at 0x7ff1704cf870>
               options: {...} (12)
               loop: {...} (13)
               view: <LocationProxy None at 0x7ff16d6f1098>

Thanks :)

@ramonski

This comment has been minimized.

Copy link
Contributor

commented Apr 10, 2019

This is an issue caused by the expression laboratory/PhysicalAddress/address (see second line).
Can you please open an issue for that and show what you entered in the laboratory PhysicalAddress address fields?
Thanks

@siyamalan

This comment has been minimized.

Copy link
Author

commented Apr 10, 2019

All issues sorted :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.