예제 #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()
예제 #2
0
파일: mgmt.py 프로젝트: janusnic/MeTal
def theme_apply_to_blog(theme, blog):
    '''
    Applies a given theme to a given blog.
    Removes and regenerates fileinfos for the pages on the blog.
    '''

    from core import cms
    cms.purge_fileinfos(blog.fileinfos)

    mappings_to_remove = TemplateMapping.delete().where(
        TemplateMapping.template << blog.templates)
    mappings_to_remove.execute()

    theme_to_remove = Template.delete().where(Template.blog == blog)
    theme_to_remove.execute()

    theme_install_to_blog(theme, blog)