Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Unanswered
How to upload files using download_file()

An extension that I am working on needs to take a document as input so that it can be sent somewhere as an attachment. When looking at the docs, this page is the most relevant: https://docs.q2developer.com/guides/online_integration/file_uploads.html?highlight=upload%20files.

The issue that I am running into is the function download_file() does not seem to be working. I am following the instructions exactly how they are typed, but I keep getting the following error: "TypeError: NoneType object is not iterable". I know that there is content in the input box, so I do not uderstand where this error is coming from.

file

This is the relevant frontend code that I am running.

HTML:

<div class="upload-docs-box">
    <input type="file" id="filename" name="filename">
</div>

JavaScript:

window.submitInfo = function submitInfo() {
		// Display a loading modal
		tecton.actions.showLoadingModal(title = 'Uploading documents...');

		tecton.sources.requestExtensionData({
				route: 'send_documents',
				body: {}
		})
				.then(response => {
						// Get rid of the loading modal
						tecton.actions.clearLoadingModal();

						alert("File Uploaded")
				})
				.catch(error => {
						// Get rid of loading modal
						tecton.actions.clearLoadingModal();

						// Display error modal
						tecton.actions.showModal({
								title: 'Error',
								message: 'Something went wrong uploading your documents. Please try again or call our Contact Center for further assistance.',
								modalType: 'error',
								isBlocking: true
						})
				});
}

Python:

@ajax
async def send_documents(self) -> Success:
		"""
		Send the uploaded dispute documents to the CSRs.

		return: Informs the frontend if function was successful and passes info load
		"""
		file_bytes = await self.download_file('filename')

		return Success({})

If it is relevant, I am working in the Sandbox and am attempting to upload a .txt file and a .pdf file as tests.

0

Ardent was apparently down yesterday in dev. Could you try again and report back?

— Trey Teter   3 years ago
0

I'm running into this same issue, have you been able to get it working?

— Bradley Bell   11 months ago
Votes Newest

Answers

182 Views
0 Answers
3 years ago
3 years ago
Tags