def add_folder(self): schema = FolderSchema() form = Form(schema, buttons=('submit',)) if 'submit' in self.request.POST: # Make a new Folder title = self.request.POST['title'] name = str(randint(0,999999)) new_folder = Folder(title) new_folder.__name__ = name new_folder.__parent__ = self.context self.context[name] = new_folder # Redirect to the new folder url = self.request.resource_url(new_folder) return HTTPFound(location=url) return {"form": form.render()}
def add_folder(self): schema = FolderSchema() form = Form(schema, buttons=('submit', )) if 'submit' in self.request.POST: # Make a new Folder title = self.request.POST['title'] name = str(randint(0, 999999)) new_folder = Folder(title) new_folder.__name__ = name new_folder.__parent__ = self.context self.context[name] = new_folder # Redirect to the new folder url = self.request.resource_url(new_folder) return HTTPFound(location=url) return {"form": form.render()}
def add_folder_view(self): # Make a new Folder title = self.request.POST['folder_title'] name = str(randint(0, 999999)) new_folder = Folder(name, self.context, title) self.context[name] = new_folder # Redirect to the new folder url = self.request.resource_url(new_folder) return HTTPFound(location=url)
def add_folder(self): schema = FolderSchema() form = Form(schema, buttons=('submit', )) if 'submit' in self.request.POST: # Make a new Folder title = self.request.POST['title'] doc_id = self.document_map.new_docid() name = "folder%s" % doc_id new_folder = Folder(title) new_folder.__name__ = name new_folder.__parent__ = self.context self.context[name] = new_folder # map object path to catalog id path = resource_path(new_folder) self.document_map.add(path, doc_id) # index new folder self.catalog.index_doc(doc_id, new_folder) # Redirect to the new folder url = self.request.resource_url(new_folder) return HTTPFound(location=url) return {"form": form.render()}
def add_folder(self): schema = FolderSchema() form = Form(schema, buttons=('submit',)) if 'submit' in self.request.POST: # Make a new Folder title = self.request.POST['title'] doc_id = self.document_map.new_docid() name = "folder%s" % doc_id new_folder = Folder(title) new_folder.__name__ = name new_folder.__parent__ = self.context self.context[name] = new_folder # map object path to catalog id path = resource_path(new_folder) self.document_map.add(path, doc_id) # index new folder self.catalog.index_doc(doc_id, new_folder) # Redirect to the new folder url = self.request.resource_url(new_folder) return HTTPFound(location=url) return {"form": form.render()}