review comments

This commit is contained in:
Pascal Krahmer 2024-02-04 23:02:51 +01:00
parent be3168d652
commit 0cc773f941

View File

@ -309,10 +309,9 @@ class BarcodePlugin(ConsumeTaskPlugin):
for raw in tag_texts.split(","): for raw in tag_texts.split(","):
try: try:
tag = None tag = None
for regex in settings.CONSUMER_TAG_BARCODE_MAPPING:
mappings = settings.CONSUMER_TAG_BARCODE_MAPPING.items()
for regex, sub in mappings:
if re.match(regex, raw, flags=re.IGNORECASE): if re.match(regex, raw, flags=re.IGNORECASE):
sub = settings.CONSUMER_TAG_BARCODE_MAPPING[regex]
tag = ( tag = (
re.sub(regex, sub, raw, flags=re.IGNORECASE) re.sub(regex, sub, raw, flags=re.IGNORECASE)
if sub if sub