Example #1
0
def delete(template):

    t0 = FileInfo.delete().where(
        FileInfo.template_mapping << template.mappings)
    t0.execute()
    t1 = TemplateMapping.delete().where(
        TemplateMapping.id << template.mappings)
    t1.execute()
    t2 = Template.delete().where(Template.id == template.id)
    t2.execute()
Example #2
0
def delete_page_fileinfo(page):
    '''
    Deletes the fileinfo entry associated with a specific page.
    This does not perform any security checks.
    This also does not delete anything from the filesystem.
    '''

    fileinfo_to_delete = FileInfo.delete().where(FileInfo.page == page)

    return fileinfo_to_delete.execute()
Example #3
0
def purge_fileinfos(fileinfos):
    '''
    Takes a collection of fileinfos in the form of a model
    and removes them from the fileinfo list.
    Returns how many entries were purged.
    No security checks are performed.
    '''
    context_purge = FileInfoContext.delete().where(FileInfoContext.fileinfo << fileinfos)
    n = context_purge.execute()
    purge = FileInfo.delete().where(FileInfo.id << fileinfos)
    m = purge.execute()
    return m, n