-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Subscriber adapters not supported in clients listing #1418
Conversation
The custom ClientFolderView is overriding before_render and folder_item functions, but without calling their respective functions from the base class. Thus, subscriber adapters where not considered.
bika/lims/browser/clientfolder.py
Outdated
@@ -132,6 +132,9 @@ def __init__(self, context, request): | |||
def before_render(self): | |||
"""Before template render hook | |||
""" | |||
# Call `before_render` from the base class | |||
BikaListingView.before_render(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind to use super
here instead of calling the named base class directly?
E.g. like here: https://github.com/senaite/senaite.core/blob/master/bika/lims/browser/worksheet/views/folder.py#L205
bika/lims/browser/clientfolder.py
Outdated
# Call the folderitem method from the base class | ||
item = BikaListingView.folderitem(self, obj, item, index) | ||
if not item: | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also use the super
call here instead of calling the named base class, e.g.:
https://github.com/senaite/senaite.core/blob/master/bika/lims/browser/worksheet/views/analyses_transposed.py#L70
Btw, when can this happen that the item
is None
?
The thing with None
values here is that the listing count would be wrong and I'm not sure if this is handled gracefully in senaite.core.listing
, because it expects there dicts as folderitems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, when can this happen that the item is None?
Indeed, it should not happen. And if it somehow happens, better to handle that as bug than obfuscating the anomaly here. So I agree with you
folderitem function is called by the folder_items function from the base class, that is already in charge of calling the function folderitem from subscriber adapters
@ramonski just noted that there was only the need to call the function |
Description of the issue/feature this PR addresses
The custom
ClientFolderView
was overridingbefore_render
andfolder_item
functions, but without calling their respective functions from the base class. Thus, subscriber adapters wherenot considered in clients listing.
Current behavior before PR
Client listing cannot be extended or its behavior changed by means of subscriber adapters.
Desired behavior after PR is merged
Client listing can be extended or its behavior changed by means of subscriber adapters.
--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.