Batch Label Creation/Editing error: zope.traversing.namespace.view #750
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the issue/feature this PR addresses
Linked issue: #590
Current behavior before PR
For Batch Labels, both when:
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):
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
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 underprofiles/default/types
be reloaded in someway?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.senaite.core/bika/lims/controlpanel/bika_batchlabels.py
Lines 66 to 67 in ef7c16f
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.