Fix accreditation body logo rendering after Laboratory DX migration#167
Open
ramonski wants to merge 1 commit into
Open
Fix accreditation body logo rendering after Laboratory DX migration#167ramonski wants to merge 1 commit into
ramonski wants to merge 1 commit into
Conversation
senaite.core 2.7 migrated the Laboratory to Dexterity, so the accreditation body logo is now a plone.namedfile NamedBlobImage instead of an Archetypes image. The sample info template still resolved its URL via `absolute_url`, which a NamedBlobImage does not provide, raising an error when rendering the default report for an accredited laboratory with a logo. Add a `get_accreditation_logo_url` helper that serves the logo through the standard `@@images` view and use it in the info template, keeping the bundled default image as fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
senaite.core 2.7 migrated the
Laboratorycontent type to Dexterity, so its accreditation body logo is now aplone.namedfile.NamedBlobImageinstead of an Archetypes image. The sample info template still built the imagesrcviaaccreditation_logo/absolute_url, which aNamedBlobImagedoes not provide.Current behavior before PR
Rendering the default report (
senaite.impress:Default.pt) for an accredited laboratory that has an accreditation logo uploaded raises:Desired behavior after PR is merged
The accreditation logo renders correctly. A new
get_accreditation_logo_urlhelper on the report view serves theNamedBlobImagethrough the standard@@imagesview ({laboratory_url}/@@images/accreditation_body_logo), andinfo.ptuses it. The existing fallback to the bundledAccreditationBodyLogo.pngis kept for laboratories without a custom logo.--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.