@@ 496-511 (lines=16) @@ | ||
493 | return version |
|
494 | ||
495 | ||
496 | def _create_html_diff( |
|
497 | from_version: DbSnippetVersion, |
|
498 | to_version: DbSnippetVersion, |
|
499 | attribute_name: str, |
|
500 | ) -> Optional[str]: |
|
501 | """Create an HTML diff between the named attribute's value of each |
|
502 | of the two versions. |
|
503 | """ |
|
504 | from_description = format_datetime_short(from_version.created_at) |
|
505 | to_description = format_datetime_short(to_version.created_at) |
|
506 | ||
507 | from_text = getattr(from_version, attribute_name) |
|
508 | to_text = getattr(to_version, attribute_name) |
|
509 | ||
510 | return text_diff_service.create_html_diff( |
|
511 | from_text, to_text, from_description, to_description |
|
512 | ) |
|
513 |
@@ 647-658 (lines=12) @@ | ||
644 | return version |
|
645 | ||
646 | ||
647 | def _create_html_diff(from_version, to_version, attribute_name): |
|
648 | """Create an HTML diff between the named attribute's value of each |
|
649 | of the two versions. |
|
650 | """ |
|
651 | from_description = format_datetime_short(from_version.created_at) |
|
652 | to_description = format_datetime_short(to_version.created_at) |
|
653 | ||
654 | from_text = getattr(from_version, attribute_name) |
|
655 | to_text = getattr(to_version, attribute_name) |
|
656 | ||
657 | return text_diff_service.create_html_diff( |
|
658 | from_text, to_text, from_description, to_description |
|
659 | ) |
|
660 |