Ejemplo n.º 1
0
 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()}
Ejemplo n.º 2
0
 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()}
Ejemplo n.º 3
0
 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()}
Ejemplo n.º 4
0
 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()}