@@ -76,21 +76,23 @@ def get_or_create_component_type(namespace: str, name: str) -> ComponentType:
7676 return component_type
7777
7878
79- def create_component (
79+ def create_component ( # pylint: disable=too-many-positional-arguments
8080 learning_package_id : int ,
8181 / ,
8282 component_type : ComponentType ,
8383 local_key : str ,
8484 created : datetime ,
8585 created_by : int | None ,
86+ * ,
87+ can_stand_alone : bool = True ,
8688) -> Component :
8789 """
8890 Create a new Component (an entity like a Problem or Video)
8991 """
9092 key = f"{ component_type .namespace } :{ component_type .name } :{ local_key } "
9193 with atomic ():
9294 publishable_entity = publishing_api .create_publishable_entity (
93- learning_package_id , key , created , created_by
95+ learning_package_id , key , created , created_by , can_stand_alone
9496 )
9597 component = Component .objects .create (
9698 publishable_entity = publishable_entity ,
@@ -239,13 +241,20 @@ def create_component_and_version( # pylint: disable=too-many-positional-argumen
239241 title : str ,
240242 created : datetime ,
241243 created_by : int | None = None ,
244+ * ,
245+ can_stand_alone : bool = True ,
242246) -> tuple [Component , ComponentVersion ]:
243247 """
244248 Create a Component and associated ComponentVersion atomically
245249 """
246250 with atomic ():
247251 component = create_component (
248- learning_package_id , component_type , local_key , created , created_by
252+ learning_package_id ,
253+ component_type ,
254+ local_key ,
255+ created ,
256+ created_by ,
257+ can_stand_alone = can_stand_alone ,
249258 )
250259 component_version = create_component_version (
251260 component .pk ,
0 commit comments