added method to update context

This commit is contained in:
Jakub Trllo 2024-10-01 19:01:16 +02:00
parent 7537cf8ebc
commit b35055c3c7
3 changed files with 18 additions and 0 deletions

View file

@ -347,6 +347,12 @@ class AbstractPublisherFrontend(AbstractPublisherCommon):
):
pass
@abstractmethod
def set_instances_context_info(
self, changes_by_instance_id: Dict[str, Dict[str, Any]]
):
pass
@abstractmethod
def get_existing_product_names(self, folder_path: str) -> List[str]:
pass

View file

@ -195,6 +195,11 @@ class PublisherController(
def get_instances_context_info(self, instance_ids=None):
return self._create_model.get_instances_context_info(instance_ids)
def set_instances_context_info(self, changes_by_instance_id):
return self._create_model.set_instances_context_info(
changes_by_instance_id
)
def get_convertor_items(self):
return self._create_model.get_convertor_items()

View file

@ -447,6 +447,13 @@ class CreateModel:
instances
)
def set_instances_context_info(self, changes_by_instance_id):
with self._create_context.bulk_value_changes(CREATE_EVENT_SOURCE):
for instance_id, changes in changes_by_instance_id.items():
instance = self._get_instance_by_id(instance_id)
for key, value in changes.items():
instance[key] = value
def get_convertor_items(self) -> Dict[str, ConvertorItem]:
return self._create_context.convertor_items_by_id