def get(self, args, format): type = args.split("/")[0] key = args.split("/")[1] model = db.get(key) result = model.delete() self.ws.site.sanity_check() for role in Role.all().fetch(1000): role.sanity_check() for permission in Permission.all().fetch(1000): permission.sanity_check() memcache.flush_all() self.response.out.write(type + " : " + key)
def generate_admin_html(self, page, user): contents = Content.all().fetch(1000) roles = Role.all().fetch(1000) emaildata = {"contents": contents, "roles": roles} emailcontext = template.Context(emaildata) email_template = template.Template(open("templates/email.html").read()) email_html = email_template.render(emailcontext) admindata = { "page_edit": Page.to_form(self.request.path, "edit", page.key()), "theme_edit": Theme.to_form(self.request.path, "edit", page.theme.key(), page.key()), "page_key": page.key(), "path": self.request.path, "permission_table": Permission.get_table(page.key()), "sections": ( { "name": section.name.replace("section_", "").capitalize(), "theme_key": section.theme.key(), "theme_html": section.theme.html, "theme_css": section.theme.css, "theme_js": section.theme.js, "content": ( { "title": content.title, "content_edit": Content.to_edit_list("title", self.request.path), "content_form": Content.to_form( self.request.path, "edit", content.key(), section.key() ), "content_deepform": Content.to_form(self.request.path, rel_key=section.key()), } for content in section.get_contents() ), } for section in page.get_sections() ), "page_form": Page.to_form(self.request.path, rel_key=self.ws.site.key()), "user_form": User.to_form(self.request.path), "user_list": User.to_edit_list("email", self.request.path, True), "user_edit_form": User.to_form(self.request.path, "edit", user.key()), "user_import": open("defaults/admin/user_import.html").read(), "images": self.ws.site.images_for_use(), "email_blast": email_html, } context = template.Context(admindata) admin_template = template.Template(open("defaults/admin/tabs.html").read()) admin_html = admin_template.render(context) return admin_html