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

Batch Label Creation/Editing error: zope.traversing.namespace.view #750

Merged
merged 3 commits into from
Mar 28, 2018
Merged

Batch Label Creation/Editing error: zope.traversing.namespace.view #750

merged 3 commits into from
Mar 28, 2018

Conversation

juangallostra
Copy link
Contributor

Description of the issue/feature this PR addresses

Linked issue: #590

Current behavior before PR

For Batch Labels, both when:

  • Clicking Save after creating a new one
  • Clicking on the title of one of them in the Batch Labels listing (under bika Setup / Batch Labels)

the browser refreshes a blank page with the text:
<zope.traversing.namespace.view object at 0x7fdf19e00550>

Desired behavior after PR is merged

In both cases the user is redirected to the Edit page of the Batch Label and the message showed in the previous section does not appear.

Notes (Please read):

  1. Issue Batch label create error zope.traversing.namespace.view #590 suggests redirecting to Batch Labels' listing view. However, after inspecting some of the other areas (AR Templates, Analysis Categories, Analysis Profiles, Analysis Services, Analysis Specifications, Attachment Types), I've noticed that all of them redirect after creation to the respective Edit view. So the changes included in this PR apply the same behavior to Batch Labels

  2. I don't know if I missed something, but for the change to be effective I had to setup a new instance. I wasn't able to find a way to make it work with an already installed instance. Can the xml files under profiles/default/types be reloaded in someway?

  3. There is another possible approach which is to:
    3.1 In order to solve the editing problem: Modify in bika_batchlabels.py, line 67, the piece of code items[x]['url'] by '/'.join([items[x]['url'], 'edit']) so as to redirect when clicking the Title to the Batch Label's edit view.

    items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \
    (items[x]['url'], items[x]['Title'])

    3.2 Change also the behavior of the Save button to redirect either to the Edit view or the listing.

    @xispa @ramonski Maybe this second approach is better?

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

Copy link
Contributor

@ramonski ramonski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks Juan!

@ramonski ramonski merged commit 41ec19e into senaite:master Mar 28, 2018
@ramonski
Copy link
Contributor

Hi Juan, I tested your approach on https://senaite.ridingbytes.com, and it seems to work perfectly:

controls the available content types in your portal 2018-03-28 17-10-26

However, I was too quick accepting this PR, because the type XML's are not run automatically and need an upgrade step.
Basically that upgrade step fetches the portal_types tool and set the value programatically.

Regarding your questions above, I think your approach is the least invasive change and I would therefor prefer it over the other ones.

Thanks!

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