From fbaed95fd43d1b6781f39e1f0ebfa27f9d36da95 Mon Sep 17 00:00:00 2001 From: Adrian Coveney Date: Mon, 27 Nov 2023 14:16:53 +0000 Subject: [PATCH 1/2] Fix full header matching to strip input - Trailing whitespace was throwing this off before. --- apel/db/loader/record_factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apel/db/loader/record_factory.py b/apel/db/loader/record_factory.py index b93a534e0..cc74f5848 100644 --- a/apel/db/loader/record_factory.py +++ b/apel/db/loader/record_factory.py @@ -108,7 +108,7 @@ def create_records(self, msg_text): except KeyError: try: # Use the full header to distinguish normalised and non-norm summaries. - record_type = record_mapping[header] + record_type = record_mapping[header.strip()] except KeyError: raise RecordFactoryException('Message type %s not recognised.' % header) From e0624fca3348a052991963bdc492ed307c534970 Mon Sep 17 00:00:00 2001 From: Adrian Coveney Date: Wed, 20 Nov 2024 14:07:39 +0000 Subject: [PATCH 2/2] Remove space added by unloader after header Due to changes in the way the loader now works, this additional whitespace was causing messages to be rejected as the header wasn't being trimmed before matching. While the incoming header is now trimmed by the previous commit, the unloaded header shouldn't have a trailing space anyway. --- apel/db/unloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apel/db/unloader.py b/apel/db/unloader.py index fbd88ba06..31e87dffd 100644 --- a/apel/db/unloader.py +++ b/apel/db/unloader.py @@ -272,7 +272,7 @@ def _write_apel(self, records): record_type = type(records[0]) buf = StringIO.StringIO() - buf.write(self.APEL_HEADERS[record_type] + ' \n') + buf.write(self.APEL_HEADERS[record_type] + '\n') buf.write('%%\n'.join( [ record.get_msg(self._withhold_dns) for record in records ] )) buf.write('%%\n')