Code Duplication    Length = 12-12 lines in 2 locations

src/bika/lims/validators.py 2 locations

@@ 402-413 (lines=12) @@
399
                    })
400
                instance.REQUEST[key] = to_utf8(translate(msg))
401
                return instance.REQUEST[key]
402
            if 'keyword' in field and \
403
               field['keyword'] in keyword_titles.keys() and \
404
               keyword_titles[field['keyword']] != field['title']:
405
                msg = _(
406
                    "Validation failed: keyword '${keyword}' "
407
                    "must have column title '${title}'",
408
                    mapping={
409
                        'keyword': safe_unicode(field['keyword']),
410
                        'title': safe_unicode(keyword_titles[field['keyword']])
411
                    })
412
                instance.REQUEST[key] = to_utf8(translate(msg))
413
                return instance.REQUEST[key]
414
415
        # Check if choices subfield is valid
416
        for interim in interim_fields:
@@ 390-401 (lines=12) @@
387
        for field in interim_fields:
388
            if field['keyword'] != value:
389
                continue
390
            if 'title' in field and \
391
               field['title'] in title_keywords.keys() and \
392
               title_keywords[field['title']] != field['keyword']:
393
                msg = _(
394
                    "Validation failed: column title '${title}' "
395
                    "must have keyword '${keyword}'",
396
                    mapping={
397
                        'title': safe_unicode(field['title']),
398
                        'keyword': safe_unicode(title_keywords[field['title']])
399
                    })
400
                instance.REQUEST[key] = to_utf8(translate(msg))
401
                return instance.REQUEST[key]
402
            if 'keyword' in field and \
403
               field['keyword'] in keyword_titles.keys() and \
404
               keyword_titles[field['keyword']] != field['title']: