Commit graph

3718 commits

Author SHA1 Message Date
David Lord
4d904d4f29 move url matching after opening session 2019-06-13 12:40:01 -07:00
Elad Moshe
26cde0536c wait until app ctx is ready before matching url
`RequestContext.match_request` is moved from `__init__` to `push`. This
causes matching to happen later, when the app context is available.
This enables URL converters that use things such as the database.
2019-06-13 08:32:23 -07:00
David Lord
d01a9c233c Merge pull request #3253 from aligoren/document-get-exc-class-and-code
Added :param to the _get_exc_class_and_code method docstring
2019-06-12 14:10:42 -07:00
David Lord
883fe27f04 reword _get_exc_class_and_code docstring 2019-06-12 14:09:57 -07:00
aligoren
3e1c17bd2a document _get_exc_class_and_code params 2019-06-12 14:08:45 -07:00
David Lord
bd3c45317f Merge pull request #3248 from Vicolatope/document-blueprint-parameters
Added :param to the Blueprint concstructor docstring
2019-06-12 14:02:56 -07:00
David Lord
c12a101438 reword Blueprint class docstring 2019-06-12 14:01:49 -07:00
vdanain
2f5e59d46d document Blueprint params 2019-06-12 12:09:01 -07:00
David Lord
631f98657e Merge pull request #3260 from LBWright/error-handling
adds api error handling example to documentation
2019-06-12 11:07:04 -07:00
David Lord
3ab901146c reword api error section 2019-06-12 11:02:53 -07:00
Logan Wright
bd6111273b adds api error handling documentation 2019-06-12 10:54:12 -07:00
David Lord
43f66251ad Merge branch '1.0.x' 2019-06-12 10:41:11 -07:00
David Lord
bc5269e5da remove codecov 2019-06-12 10:35:35 -07:00
David Lord
2d993a78bf Merge pull request #3261 from pallets/fix-server-name-warnings
fix tests failing with server name warnings
2019-06-12 08:17:25 -07:00
David Lord
090bc4470e fix tests failing with server name warnings
After pallets/werkzeug#1577, mismatched configured and real server
names will show a warning in addition to raising 404. This caused
tests that did this deliberately to fail.

This patch removes the pytest fixture we were using to fail on
warnings, instead using the standard `-Werror` option. This speeds
up the tests by ~3x.
2019-06-10 14:05:33 -07:00
David Lord
21854b19d9 Merge pull request #3247 from pallets/join-strings
fix string concats left over by black
2019-06-01 12:28:29 -04:00
David Lord
2cf5d51523 fix string concats left over by black 2019-06-01 09:22:20 -07:00
David Lord
f2d8721428 Merge pull request #3246 from pallets/reorder-imports
apply reorder-python-imports pre-commit config
2019-06-01 12:12:49 -04:00
David Lord
e66fe2e8e7 apply reorder-python-imports pre-commit config 2019-06-01 09:07:20 -07:00
David Lord
84520f810d Merge pull request #3245 from pallets/src-dir
move to src directory
2019-06-01 11:10:33 -04:00
David Lord
ed989713f7 move to src directory 2019-06-01 08:06:16 -07:00
David Lord
65b453b692 Merge remote-tracking branch 'origin/1.0.x' 2019-06-01 06:53:29 -07:00
David Lord
2e7b83529a Merge pull request #3241 from jon-stumpf/jss-updates
Add pre-commit config for flake8
2019-06-01 09:36:23 -04:00
Jon S. Stumpf
4dc9c68d19 address flake8 issues 2019-06-01 06:31:35 -07:00
Jon S. Stumpf
8577b347a7 add pre-commit config for flake8 2019-06-01 09:13:46 -04:00
David Lord
d6b3e5eccf Merge pull request #3244 from paulgb/master
Clarify documentation about how url_for uses configuration values (#2759)
2019-06-01 08:59:01 -04:00
David Lord
9225e16709 Merge pull request #3242 from cslecrone/3211-ssl-import
"#3211: Don't require ssl module"
2019-06-01 08:57:06 -04:00
cslecrone
f7d690e474 don't require ssl module for flask cli 2019-05-31 17:27:52 -04:00
David Lord
c194cd7b5d Merge pull request #3243 from DiegoAlbertoTorres/docs
Guard against missing request context in logging docs.
2019-05-31 16:47:32 -04:00
Paul Butler
931d62c892 Clarify documentation about how url_for uses configuration values (#2759) 2019-05-31 15:33:06 -04:00
Diego Alberto Torres Quintanilla
d296df03c2 Guard against missing request context in logging docs. 2019-05-31 14:54:03 -04:00
David Lord
797fb5f64b Merge pull request #3240 from ultimecia7/docfix
Fix testing documentation to demonstrate using test client with teardown
2019-05-31 14:06:54 -04:00
David Lord
d20cb22a41 Merge pull request #3232 from lordmauve/environbuilder
Convert make_test_environ_builder into class (fixes #3207)
2019-05-31 13:58:40 -04:00
David Lord
5723aab929 Merge pull request #3237 from scrosby/fix-3218
Move python properties to decorator syntax
2019-05-31 13:44:22 -04:00
ultimecia7
ffdc3ff595 Fix testing documentation to demonstrate using test client with teardown 2019-05-31 13:18:54 -04:00
Daniel Pope
b3115feab6 Fix name of kwargs parameter 2019-05-31 18:05:25 +01:00
Daniel Pope
39df2b7dc3 Create json_dumps() method on new EnvironBuilder 2019-05-31 18:05:25 +01:00
Daniel Pope
4d595a74a2 Convert make_test_environ_builder into class (fixes #3207) 2019-05-31 18:05:25 +01:00
David Lord
36ed441533 Merge pull request #3236 from lordmauve/no-cligroup-empty
Do not register empty CLI groups from Blueprint
2019-05-31 13:05:00 -04:00
David Lord
480f4474d4 Merge pull request #3233 from rtilk89/unused_werkzerg_import
Issue #3226: Remove unused werkzeug datastructure import
2019-05-31 12:58:44 -04:00
David Lord
e7ad7133d7 Merge pull request #3239 from gokcegrbl/GH-3227
Comment on bare except usage in _compat.py
2019-05-31 12:56:43 -04:00
David Lord
71115821c7 Merge pull request #3235 from johnzeringue/better-return-type-error
Better error message when view return type is not supported
2019-05-31 12:50:59 -04:00
gokcegrbl
3259d5b61c Comment on bare except usage in _compat.py
(Fixes pallets/flask#3227)
2019-05-31 16:27:51 +00:00
John Zeringue
d610a559d1 Better error message when view return type is not supported
Before, returning a `bool` from a route caused the error

```
[2019-05-31 10:08:42,216] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2070, in make_response
    rv = self.response_class.force_type(rv, request.environ)
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/wrappers/base_response.py", line 269, in force_type
    response = BaseResponse(*_run_wsgi_app(response, environ))
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/wrappers/base_response.py", line 26, in _run_wsgi_app
    return _run_wsgi_app(*args)
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/test.py", line 1119, in run_wsgi_app
    app_rv = app(environ, start_response)
TypeError: 'bool' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2393, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 1906, in full_dispatch_request
    return self.finalize_request(rv)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 1921, in finalize_request
    response = self.make_response(rv)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2078, in make_response
    reraise(TypeError, new_error, sys.exc_info()[2])
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/_compat.py", line 39, in reraise
    raise value.with_traceback(tb)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2070, in make_response
    rv = self.response_class.force_type(rv, request.environ)
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/wrappers/base_response.py", line 269, in force_type
    response = BaseResponse(*_run_wsgi_app(response, environ))
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/wrappers/base_response.py", line 26, in _run_wsgi_app
    return _run_wsgi_app(*args)
  File "/Users/johnzeringue/Documents/ts-open/flask/env/lib/python3.7/site-packages/werkzeug/test.py", line 1119, in run_wsgi_app
    app_rv = app(environ, start_response)
TypeError: 'bool' object is not callable
The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a bool.
```

Now, it returns the more readable

```
[2019-05-31 10:36:19,500] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2400, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 1907, in full_dispatch_request
    return self.finalize_request(rv)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 1922, in finalize_request
    response = self.make_response(rv)
  File "/Users/johnzeringue/Documents/ts-open/flask/flask/app.py", line 2085, in make_response
    " {rv.__class__.__name__}.".format(rv=rv))
TypeError: The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a bool.
```

Fixes #3214
2019-05-31 11:58:49 -04:00
Scott Crosby
dd94b021ab Move python properties to decorator syntax 2019-05-31 10:53:30 -05:00
Daniel Pope
ecdb6e98ae Do not register empty CLI groups from Blueprint
(Fixes #3224)
2019-05-31 16:49:01 +01:00
David Lord
96489146ce Merge pull request #3234 from tomowind/issue_3225
#3225: document "del tb"
2019-05-31 10:58:44 -04:00
Sang Min Park
8a10e080b5 #3225: document 2019-05-31 10:55:08 -04:00
Ryan Thielke
c8bf886ac3 Issue #3226: Remove unused werkzeug datastructure import 2019-05-31 09:52:53 -05:00
Joshua Bronson
d1e501aa71 Close issues from commit messages in CONTRIBUTING 2019-05-31 09:57:21 -04:00