Пример #1
0
def delete_page_fileinfo(page):
    '''
    Deletes the fileinfo entry associated with a specific page.
    This does not delete fileinfos that are general archives
    for that page, only fileinfos associated with page templates.
    :param page:
        The page object to remove from the fileinfo index.
    '''

    # We should probably move this to models.Page
    from core.models import Queue
    from core.cms.queue import job_type

    fileinfos_to_delete = FileInfo.select().where(FileInfo.page == page)
    # We don't use page.fileinfos because that automatically
    # regenerates any missing fileinfos.
    # TODO: have an option, false by default, to suppress that

    for n in fileinfos_to_delete:

        Queue.delete().where(
            Queue.job_type == job_type.page,
            Queue.data_integer == n.id,
            Queue.blog == page.blog,
        ).execute()

        n.delete_instance()
Пример #2
0
def _remove_from_queue(queue_deletes):
    '''
    Batch deletion of queue jobs.
    '''
    deletes = Queue.delete().where(Queue.id << queue_deletes)
    return deletes.execute()