Commit Graph

3642 Commits

Author SHA1 Message Date
Jon S. Stumpf 549fed29ea
add pre-commit config for flake8 2019-06-01 09:13:46 -04:00
David Lord b61cbf8ab4
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 13b689bba6
Merge pull request #3242 from cslecrone/3211-ssl-import
"#3211: Don't require ssl module"
2019-06-01 08:57:06 -04:00
cslecrone 1718f1934c
don't require ssl module for flask cli 2019-05-31 17:27:52 -04:00
Paul Butler a3272941ce Clarify documentation about how url_for uses configuration values (#2759) 2019-05-31 15:33:06 -04:00
David Lord 6e995f2379
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 5e15850532
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 cd4023d9d2
Merge pull request #3237 from scrosby/fix-3218
Move python properties to decorator syntax
2019-05-31 13:44:22 -04:00
ultimecia7 d981cc678a Fix testing documentation to demonstrate using test client with teardown 2019-05-31 13:18:54 -04:00
Daniel Pope e45370b994 Fix name of kwargs parameter 2019-05-31 18:05:25 +01:00
Daniel Pope c7f56c5a55 Create json_dumps() method on new EnvironBuilder 2019-05-31 18:05:25 +01:00
Daniel Pope 976dfedaa9 Convert make_test_environ_builder into class (fixes #3207) 2019-05-31 18:05:25 +01:00
David Lord 91e53da054
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 524f9c32c7
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 94e057224c
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 52f9aa7ed6
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 1b526c837e Comment on bare except usage in _compat.py
(Fixes pallets/flask#3227)
2019-05-31 16:27:51 +00:00
John Zeringue 8bb7185284 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 55ad09c902 Move python properties to decorator syntax 2019-05-31 10:53:30 -05:00
Daniel Pope f25b5000fd Do not register empty CLI groups from Blueprint
(Fixes #3224)
2019-05-31 16:49:01 +01:00
David Lord 14e9291380
Merge pull request #3234 from tomowind/issue_3225
#3225: document "del tb"
2019-05-31 10:58:44 -04:00
Sang Min Park 2a97d4a706 #3225: document 2019-05-31 10:55:08 -04:00
Ryan Thielke cd14adbc1e Issue #3226: Remove unused werkzeug datastructure import 2019-05-31 09:52:53 -05:00
Joshua Bronson 6ac4b93779
Close issues from commit messages in CONTRIBUTING 2019-05-31 09:57:21 -04:00
Joshua Bronson af1b2ea1d1
Merge pull request #3231 from pallets/jab-precommit
Add pre-commit install-hooks to first-time setup
2019-05-31 09:34:21 -04:00
Joshua Bronson 7ac2cbf63a
Add pre-commit install-hooks to first-time setup 2019-05-31 09:17:52 -04:00
David Lord 1250775a55
Merge pull request #3230 from lordmauve/azure-stylecheck
Enable stylecheck tox run on Azure pipelines (fixes #3228)
2019-05-31 08:21:24 -04:00
Daniel Pope 96b92ff9e8 Enable stylecheck tox run on Azure pipelines 2019-05-31 13:14:15 +01:00
David Lord 240e398c8d
Merge pull request #3229 from lordmauve/style-fix
Fix style issues on master using Black
2019-05-31 07:18:40 -04:00
Daniel Pope a5ff3cd01b Fix style issues on master using Black 2019-05-31 11:57:28 +01:00
David Lord 2c68f86336
Merge pull request #3157 from fantix/fix-test-client-teardown
Fix teardown bug in FlaskClient
2019-05-25 14:09:17 -07:00
Fantix King a71c167836
fix teardown bug in FlaskClient
* Fixes pytest-dev/pytest-flask#42
2019-05-25 14:03:28 -07:00
David Lord 754b729578
Merge pull request #3124 from elbeardmorez/fix_static_url_path
fix 'static_url_path' defaulting for empty paths
2019-05-25 11:23:00 -07:00
David Lord ed9ab2d3b6
strip static url trailing slash at assignment 2019-05-25 11:18:40 -07:00
Pete Beardmore a12bf290da
fix 'static_url_path' defaulting for empty paths
-prefix a path delimiter iff there's a path to delimit
-ensures a valid default static route rule is created on application
intialisation for the case 'static_folder=""' and implicit
'static_url_path'
2019-05-25 07:03:36 -07:00
David Lord b83760675d
Merge pull request #2784 from doobeh/master
Add Blueprint level cli registration-- #1357
2019-05-24 14:47:48 -07:00
Anthony Plunkett ec1ccd7530
Add Blueprint level cli command registration
Implements #1357.
Adds ability to register click cli commands onto blueprint.
2019-05-24 14:43:29 -07:00
David Lord 855d59b68b
Merge pull request #3111 from pgjones/master
Allow dictionaries return values as JSON
2019-05-24 10:39:11 -07:00
David Lord 1ecc341fe5
add quickstart about JSON responses 2019-05-24 10:28:12 -07:00
pgjones 7bf8366970
Allow dictionary return values as JSON
This supports an increasingly common usecase whereby JSON is the
primary response (rather than a templated string). Given Flask has a
short syntax for HTML reponses, it seems fitting that it should also
do so for JSON responses. In practice it allows,

     @app.route("/")
     def index():
         return {
             "api_stuff": "values",
         }
2019-05-24 09:48:55 -07:00
David Lord 2616d97f32
Merge pull request #2898 from rochacbruno/2897-Add-Extra-Files-to-CLI
Fix #2897 - Add `extra_files` option to `flask run` CLI
2019-05-24 07:32:45 -07:00
David Lord e18cc4d71d
add SeparatedPathType to accept multiple paths
Multiple paths for the reloader's `--extra-files` are accepted as one
option, separated by ':'.
2019-05-24 07:19:56 -07:00
Bruno Rocha 2308cba407
Fix #2897 - Add `extra_files` option to `flask run` CLI 2019-05-23 10:47:41 -07:00
David Lord 4fe81d7c62
Merge pull request #3208 from singingwolfboy/fakesignal-connect-via
FakeSignal should stub connect_via method
2019-05-23 08:22:07 -07:00
Joshua Bronson fe41c6c8ae
Merge pull request #3213 from jab/contributing
Add pre-commit to dev dependencies, document it and Black in CONTRIBUTING.
2019-05-23 10:55:06 -04:00
jab 33379155f6 Add pre-commit to dev dependencies, document it and pre-commit in CONTRIBUTING
Now that we have a Black pre-commit hook (#3138),
ensure pre-commit gets installed on ``pip install -e .[dev]``
and document use of Black (rather than "try to follow pep8")
in CONTRIBUTING.
2019-05-23 10:51:38 -04:00
David Baumgold fcf2eb4753
FakeSignal should stub connect_via method 2019-05-23 07:44:57 -07:00
David Lord d3e1fed777
Merge pull request #2939 from sharmaadarsh563/2937-correct-load_dotenv-return-value
Fix #2937: Ensure the consistency in load_dotenv's return type
2019-05-19 12:03:45 -07:00
Adarsh Sharma db8cb31f2b
Fix #2937: Ensure the consistency in load_dotenv's return type 2019-05-19 11:58:39 -07:00
David Lord d9fa28ba68
Merge pull request #2928 from vorelq/2926-default-port-overrides-zero
Fix #2926 `Default port overrides requesting a system assigned port`
2019-05-19 11:40:54 -07:00