def setDescription(self, description): """Sets the description of an inserted image""" if isinstance(description, str): description = description.decode('utf-8') object = IUpload(self.context) return object.setDescription(description)
def upload(self): """Upload a file to the zodb""" # keep diazo from touching this page self.request.response.setHeader('X-Theme-Disabled', 'True') context = IUpload(self.context) return context.upload()
def test_json_upload_image(self): self.portal.REQUEST['uploadfile'] = self._prepare_file('common_work.jpeg', type_='image/jpeg') self.portal.REQUEST['uploadtitle'] = 'foobar' self.portal.REQUEST['uploaddescription'] = 'foo' obj = IUpload(self.folder_object) msg = obj.upload() self.assertTrue('resolveuid/' in msg)
def test_json_upload_not_allowed(self): self.portal.REQUEST['uploadfile'] = self._prepare_file() self.portal.REQUEST['uploadtitle'] = 'foobar' self.portal.REQUEST['uploaddescription'] = 'foo' obj = IUpload(self.folder_object) msg = obj.upload() self.assertTrue('resolveuid/' in msg)
def upload(self): """Upload a file to the zodb""" context = IUpload(self.context) return context.upload()
def upload(self): """Upload a file to the zodb""" object = IUpload(self.context) return object.upload()
def upload(self): """Upload a file to the zodb""" #context = aq_inner(self.context) object = IUpload(self.context) return object.upload()
def replacefile(self): """ Replace the binary content of a file """ context = IUpload(self.context) return context.replacefile()