예제 #1
0
def update_content_metadata(channel_id, node_ids=None, exclude_node_ids=None):
    set_leaf_node_availability_from_local_file_availability(
        channel_id, node_ids=node_ids, exclude_node_ids=exclude_node_ids
    )
    recurse_annotation_up_tree(channel_id)
    calculate_channel_fields(channel_id)
    ContentCacheKey.update_cache_key()
예제 #2
0
def set_availability(channel_id, checksums=None):
    if checksums is None:
        set_local_file_availability_from_disk()
    else:
        mark_local_files_as_available(checksums)

    set_leaf_node_availability_from_local_file_availability(channel_id)
    recurse_availability_up_tree(channel_id)
    ContentCacheKey.update_cache_key()
예제 #3
0
 def post(self, request, *args, **kwargs):
     try:
         ids = request.data
         assert isinstance(ids, list)
         assert all(map(validate_uuid, ids))
     except AssertionError:
         raise ParseError("Array of ids not sent in body of request")
     queryset = ChannelMetadata.objects.filter(root__available=True)
     total_channels = queryset.count()
     if len(ids) != total_channels:
         raise ParseError("Expected {} ids, but only received {}".format(
             total_channels, len(ids)))
     if queryset.filter_by_uuids(ids).count() != len(ids):
         raise ParseError(
             "List of ids does not match the available channels on the server"
         )
     queryset.update(order=Case(*(When(id=uuid, then=i + 1)
                                  for i, uuid in enumerate(ids))))
     ContentCacheKey.update_cache_key()
     return Response({})
예제 #4
0
def set_content_invisible(channel_id, node_ids, exclude_node_ids):
    set_leaf_nodes_invisible(channel_id, node_ids, exclude_node_ids)
    recurse_annotation_up_tree(channel_id)
    set_channel_metadata_fields(channel_id)
    ContentCacheKey.update_cache_key()
예제 #5
0
파일: models.py 프로젝트: romilly/kolibri
 def delete_content_tree_and_files(self):
     # Use Django ORM to ensure cascading delete:
     self.root.delete()
     ContentCacheKey.update_cache_key()
예제 #6
0
def create_content_cache_key(apps, schema_editor):
    from kolibri.core.device.models import ContentCacheKey

    ContentCacheKey.update_cache_key()