Skip to content

Commit 7020982

Browse files
committed
Fix #1. update documentation about this exception
1 parent 93ecbc5 commit 7020982

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

doc/source/index.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ A minimal application may look like this::
5656
@app.route("/upload", methods=['GET', 'POST'])
5757
def upload_file():
5858
if request.method == 'POST':
59-
return jsonify({"result": request.get_array('file')})
59+
return jsonify({"result": request.get_array(field_name='file')})
6060
return '''
6161
<!doctype html>
6262
<title>Upload an excel file</title>
@@ -80,6 +80,9 @@ The tiny application exposes two urls: one for file upload and the other for fil
8080

8181
<input ... name=file>
8282

83+
.. warning::
84+
If 'field_name' was not specified, for example `request.get_array('file')` in upload_file() function, your browser would display "Bad Request: The browser (or proxy) sent a request that this server could not understand."
85+
8386
The latter simply throws back a csv file whenever a http request is made to http://localhost:50000/download/. `excel.make_response_from_array` takes a list of lists and a file type as parameters and sets up the mime type of the http response. If you would like to give 'tsvz' a go, please change "csv" to "tsvz".
8487

8588
More excel file formats

examples/README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
For tiny_example.py, please upload only file that ends with 'csv', 'tsv', 'csvz', 'tsvz'. And if you upload any other formats, your browser will get::
22

3-
Bad Request
3+
Internal Server Error
44

5-
The browser (or proxy) sent a request that this server could not understand.
5+
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
66

77
So in these cases, please insert in the tiny_example.py the following imports according to your file:
88

99
import pyexcel.ext.xls # for xls file
1010
import pyexcel.ext.xlsx # for xlsx file
1111
import pyexcel.ext.ods # for ods file
12+
13+
If 'field_name' is omitted in any of the function

0 commit comments

Comments
 (0)