Code Duplication    Length = 12-12 lines in 2 locations

byceps/blueprints/admin/snippet/views.py 1 location

@@ 590-601 (lines=12) @@
587
    return version
588
589
590
def _create_html_diff(from_version, to_version, attribute_name):
591
    """Create an HTML diff between the named attribute's value of each
592
    of the two versions.
593
    """
594
    from_description = format_datetime_short(from_version.created_at)
595
    to_description = format_datetime_short(to_version.created_at)
596
597
    from_text = getattr(from_version, attribute_name)
598
    to_text = getattr(to_version, attribute_name)
599
600
    return text_diff_service.create_html_diff(
601
        from_text, to_text, from_description, to_description
602
    )
603
604

byceps/blueprints/admin/news/views.py 1 location

@@ 616-627 (lines=12) @@
613
    return version
614
615
616
def _create_html_diff(from_version, to_version, attribute_name):
617
    """Create an HTML diff between the named attribute's value of each
618
    of the two versions.
619
    """
620
    from_description = format_datetime_short(from_version.created_at)
621
    to_description = format_datetime_short(to_version.created_at)
622
623
    from_text = getattr(from_version, attribute_name)
624
    to_text = getattr(to_version, attribute_name)
625
626
    return text_diff_service.create_html_diff(
627
        from_text, to_text, from_description, to_description
628
    )
629