Repository navigation
Conversation
ramonski
requested changes
Oct 8, 2026
ramonski
left a comment
Contributor
There was a problem hiding this comment.
Thanks! Only a small thing while we're already at this code.
| header = self.get_header() or {} | ||
| sender = header.get("sender") or {} | ||
| keys = ("name", "serial", "version") | ||
| return tuple([(sender.get(key) or "").strip() for key in keys]) |
Contributor
There was a problem hiding this comment.
Looks good to me. One small thing in log() while we are at it: with the empty strings we now get an interface like GeneXpert, , for every analyzer that does not send a serial or a version. Could we skip the empty ones there?
sender = filter(None, self.get_sender())
self._importlog.setInterface(", ".join(sender))
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
ASTMImporter.get_sender()assumes the (H)eader is present and that each of its three sender components is a string. Neither holds on the wire: ASTM transmits a component the analyzer did not fill as null, and a message can arrive with no header at all.Every caller then breaks, including one inside this module.
get_sender()returningNonemakesget_instrument_name()and its two siblings raiseTypeError: 'NoneType' object is not subscriptable, since they index into the result. A null component makes the AutoImportLog fail to be written:So the message is lost and no log entry records why.
Current behavior before PR
Nonefor a headerless message, anddict.getwith a default does not help for a null component: the key is there, holdingNone, so the default is never reached.Desired behavior after PR is merged
get_sender()always returns three strings, with surrounding whitespace dropped. Analyzers pad these fields to a fixed width and the Instrument they have to match is configured without the padding, so an unstripped sender silently fails to resolve.--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.