Skip to content

Commit

Permalink
Support empty node_ids in get_import_export_nodes
Browse files Browse the repository at this point in the history
When node_ids and exclude_node_ids are empty lists, we can understand
this to mean that no nodes are being selected. This is distinct from
when they are None, which means the default behaviour of selecting all
nodes. This is useful to provide a sane fallback when a manifest file
has no information about a channel.
  • Loading branch information
dylanmccall committed Jul 5, 2022
1 parent 933d5eb commit 704c71a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kolibri/core/content/utils/import_export_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def get_import_export_nodes( # noqa: C901
nodes_query = nodes_to_include

# if requested, filter down to only include particular topics/nodes
if node_ids:
if node_ids is not None:
nodes_query = nodes_query.filter_by_uuids(
_mptt_descendant_ids(
channel_id, node_ids, min_boundary, min_boundary + dynamic_chunksize
Expand All @@ -186,7 +186,7 @@ def get_import_export_nodes( # noqa: C901
nodes_query = nodes_query.filter(renderable_contentnodes_q_filter)

# filter down the query to remove files associated with nodes we've specifically been asked to exclude
if exclude_node_ids:
if exclude_node_ids is not None:
nodes_query = nodes_query.order_by().exclude_by_uuids(
_mptt_descendant_ids(
channel_id,
Expand Down

0 comments on commit 704c71a

Please sign in to comment.