|
9 | 9 |
|
10 | 10 | from contextlib import nullcontext |
11 | 11 | from datetime import datetime, timezone |
12 | | -from typing import ContextManager, Optional |
| 12 | +from typing import ContextManager, Optional, cast |
13 | 13 |
|
14 | 14 | from django.core.exceptions import ObjectDoesNotExist |
15 | 15 | from django.db.models import F, Prefetch, Q, QuerySet |
@@ -824,7 +824,7 @@ def _create_side_effects_for_change_log(change_log: DraftChangeLog | PublishLog) |
824 | 824 | # "This Unit's version stayed the same, but its dependency hash changed |
825 | 825 | # because a child Component's draft version was changed." We gather them |
826 | 826 | # all up in a list so we can do a bulk_update on them. |
827 | | - branch_objs_to_update_with_side_effects = [] |
| 827 | + branch_objs_to_update_with_side_effects: list[Draft | Published] = [] |
828 | 828 |
|
829 | 829 | while changes_and_affected: |
830 | 830 | change, affected = changes_and_affected.pop() |
@@ -854,9 +854,11 @@ def _create_side_effects_for_change_log(change_log: DraftChangeLog | PublishLog) |
854 | 854 | # Update the current branch pointer (Draft or Published) for this |
855 | 855 | # entity to point to the side_effect_change (if it's not already). |
856 | 856 | if branch_cls == Published: |
857 | | - published_obj = affected # 'affected' is the current Published object |
| 857 | + published_obj = cast(Published, affected) |
858 | 858 | if published_obj.publish_log_record_id != side_effect_change.pk: |
859 | | - published_obj.publish_log_record = side_effect_change |
| 859 | + published_obj.publish_log_record = cast( |
| 860 | + PublishLogRecord, side_effect_change |
| 861 | + ) |
860 | 862 | branch_objs_to_update_with_side_effects.append(published_obj) |
861 | 863 | elif branch_cls == Draft: |
862 | 864 | draft_obj = affected # 'affected' is the current Draft object |
|
0 commit comments