Esempio n. 1
0
        #uninstall old template
        if cls.is_template_installed():
            old_template = cls.get_current_template()
            old_template.uninstall()

        new_template = Template()
        new_template.set_name(manifest['name'])
        new_template.set_description(manifest['description'])
        new_template.set_author(manifest['author'])

        #create pages
        for page in pagedata:
            Page.create(page['name'],
                                page['internal_name'],
                                page['desc'],
                                page['html_body'],
                                page['html_head'],
                                page['css'],
                                page['minimap'])    

        #put binary into database
        for bin_filename in os.listdir(temp_installpath+"/static"):
            binary=None
            try:
                bin_file = open(temp_installpath+"/static/"+bin_filename,"rb")
                bin_data = bin_file.read()
                bin_file.close()
                # TODO: Find more generic way to determine mimetype
                if bin_filename.endswith(".png"):
                    binary = Binary.create("image/png", bin_data)
                if bin_filename.endswith(".jpeg") or bin_filename.endswith(".jpg"):