def add_folder(self): POST = self.request.POST if 'form.submitted' in POST: title = POST.get('title') author = POST.get('author') if title and author: # Valid form, add some data folder = Folder() folder.title = title folder.author = author folder.type = 'folder' folder.modified = _now() self.context[_title_to_name(title, self.context)] = folder return Response('ok') return render_to_response('templates/add_folder.pt', {})
def add_file(self): #XXX this needs to change to use a real File type, with an uploaded # body. POST = self.request.POST if 'form.submitted' in POST: title = POST.get('title') author = POST.get('author') if title and author: # Valid form, add some data folder = Folder() folder.title = title folder.author = author folder.type = 'folder' folder.modified = _now() self.context[_title_to_name(title, self.context)] = folder return Response('ok') return render_to_response('templates/add_file.pt', {})