Commit Graph

646 Commits

Author SHA1 Message Date
David Lord 1263d3bd14
remove deprecated code 2020-04-04 12:10:00 -07:00
David Lord a0a61acdec
drop support for Python 2.7 and 3.5 2020-04-04 12:09:55 -07:00
David Lord 64ba43411f
Merge remote-tracking branch 'origin/1.1.x' 2020-02-15 10:40:32 -08:00
frostming d4076cf07c
strip the ending slash for static_url_path 2020-02-10 18:19:25 -08:00
David Lord bcde664f9a
cli checks for cryptography library 2020-02-10 17:34:19 -08:00
Marc Hernandez Cabot 5da342e4dd
fix docstring and remove redundant parentheses 2020-02-10 17:03:52 -08:00
raymond-devries 900fa2f795 Feature request #3445. 2020-02-10 13:09:53 -08:00
David Lord 0834da832a
Merge branch '1.1.x' 2020-02-10 10:16:20 -08:00
David Lord 63b40254e9
xfail __main__ instance test interacting with tox 2020-02-10 10:16:08 -08:00
Grey Li ef434ea998
Replace old pocoo links everywhere
pocco.org -> palletsprojects.com
2019-11-19 09:32:35 -08:00
David Lord 980168d084
send_file doesn't allow StringIO 2019-11-19 08:52:12 -08:00
David Lord a83d6d2528
Merge remote-tracking branch 'origin/1.1.x' 2019-11-18 17:54:20 -08:00
Fernanda Guimarães c367a86cc5 Test test_send_from_directory_bad_request no longer fails in Python 3.8. 2019-10-28 21:37:25 -03:00
pgjones 829aa65e64
Support loading configuration from text files
TOML is a very popular format now, and is taking hold in the Python
ecosystem via pyproject.toml (among others). This allows toml config
files via,

    app.config.from_file("config.toml", toml.loads)

it also allows for any other file format whereby there is a loader
that takes a string and returns a mapping.
2019-10-18 09:15:47 -07:00
Doron Horwitz 0c0b31a789
get_cookie_name in SessionInterface for easier overriding in SecureCookieSessionInterface 2019-10-12 19:12:27 -07:00
David Lord 1617202d91
restore and deprecate json_available 2019-07-08 10:26:12 -07:00
David Lord b08e35e4ab
show warning for old logger config 2019-07-02 11:39:00 -07:00
David Lord df470aecb9
use app.name as app.logger name 2019-07-01 14:56:18 -07:00
David Lord b05a685a03
Merge branch '1.0.x' 2019-07-01 10:54:31 -07:00
Anthony Sottile a5ecdfa7a5
Fixes for PEP451 import loaders and pytest 5.x
- pytest 5.x drops python2 compatibility and therefore only implements PEP 451
- pytest 5.x made the repr of `ExcInfo` less confusing (fixed tests depending
  on the old format)
2019-07-01 10:43:06 -07:00
David Lord afd6250bab
Merge branch '1.0.x' 2019-07-01 09:52:06 -07:00
Anthony Sottile ac302fb607 Make the changelog UTF-8 compatible 2019-07-01 07:36:20 -07:00
David Lord 54cbb4e642
send_file quotes ":/" in UTF-8 filename 2019-06-27 07:55:22 -07:00
David Lord 1351d0a565
Merge branch '1.0.x' 2019-06-23 16:57:52 -07:00
David Lord e666f7a69c
standardize license and copyright 2019-06-22 13:09:09 -07:00
David Lord 9054f6d639
always pass InternalServerError instance to 500 handler 2019-06-19 14:52:25 -07:00
David Lord c65863912b
move url matching after opening session 2019-06-13 12:40:01 -07:00
Elad Moshe 1ff98a2d21
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 29111a3259
Merge branch '1.0.x' 2019-06-12 10:41:11 -07:00
David Lord dbd4520ccb
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 53c893b646
fix string concats left over by black 2019-06-01 09:22:20 -07:00
David Lord 43483683b2
apply reorder-python-imports pre-commit config 2019-06-01 09:07:20 -07:00
Jon S. Stumpf b46f5942a5
address flake8 issues 2019-06-01 06:31:35 -07:00
Jon S. Stumpf 549fed29ea
add pre-commit config for flake8 2019-06-01 09:13:46 -04:00
cslecrone 1718f1934c
don't require ssl module for flask cli 2019-05-31 17:27:52 -04: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
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
Daniel Pope f25b5000fd Do not register empty CLI groups from Blueprint
(Fixes #3224)
2019-05-31 16:49:01 +01:00
Daniel Pope a5ff3cd01b Fix style issues on master using Black 2019-05-31 11:57:28 +01: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 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
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
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
Adarsh Sharma db8cb31f2b
Fix #2937: Ensure the consistency in load_dotenv's return type 2019-05-19 11:58:39 -07:00
vorelq e1cc16f8be
Fix 0 port value being overriden by default
By explicitly comparing port value with None,
instead of using its bool() value.
2019-05-19 11:36:47 -07:00
Eruvanos 6af14f058b
support dataclass in JSONEncoder 2019-05-18 21:37:54 -07:00
Frankie Liu 2039e2e3b6
Remove ending slash from static_url_path 2019-05-18 21:23:14 -07:00
EtiennePelletier 8590d65a57
Use Werkzeug's JSONMixin class and update tests
Flask's JSONMixin class was moved to Werkzeug>=0.15

Co-authored-by: Jeffrey Eliasen <jeff@jke.net>
2019-05-18 20:57:26 -07:00
LeeW 1f3923a999
Inherit "methods" in MethodView
* Current behavior: If a base class inherits MethodView and child class
  inherits without overwriting "methods". The "methods" defined in base
  class would be ignored
* Fix: Inherit all the "methods" defined in base classes if "methods"
  variable is not overwritten
2019-05-17 13:57:06 -07:00
David Lord 6f703a564c
clean up open_resource and tests 2019-05-17 13:23:27 -07:00
icreatedanaccount ad709be46e
Allow mode='rt' on open_resource() helper 2019-05-17 13:22:13 -07:00
David Lord 05a4e15ee4
Merge branch '1.0.x' 2019-05-17 11:13:08 -07:00
David Lord a4f0f19796
don't push app context for test client json 2019-05-17 09:00:08 -07:00
David Baumgold 025589ee76 Reformat with black
https://github.com/python/black
2019-05-06 16:28:58 -04:00
David Lord a74864ec22
Merge remote-tracking branch 'origin/1.0-maintenance' 2019-01-07 10:00:10 -08:00
David Lord 662ce2151d
add changelog for GH-2986 2019-01-07 09:52:54 -08:00
Jimmy Jia b92b2e6c74
Do not handle RoutingExceptions with app error handlers 2019-01-07 09:01:37 -08:00
garenchan 40118e785f
Make sure the attachment filename is text type.
If attachment filename is bytes type and contains non-ascii coded bytes,
then the following ASCII encoding process will trigger
UnicodeDecodeError exception.

Fix issue #2933.
2019-01-07 07:17:33 -08:00
David Lord 366f3f49af
add changelog for GH-2957 2019-01-07 06:56:20 -08:00
Ignasi Bosch b570bf699c
Allow partial content on bytesio 2019-01-07 06:17:36 -08:00
David Lord 4f3dbb3f3b
Merge branch '1.0-maintenance' 2019-01-06 16:33:17 -08:00
David Lord a0ccc47780
clean up flask --version code 2019-01-06 16:24:05 -08:00
Matt Robenolt 25de45cbb6
Add support for PathLike objects in static file helpers
See: https://www.python.org/dev/peps/pep-0519/

This is mostly encountered with pathlib in python 3, but this API
suggests any PathLike object can be treated like a filepath with
`__fspath__` function.
2019-01-05 15:23:47 -08:00
David Lord f7d50d4b67
Merge branch '1.0-maintenance' 2019-01-05 15:12:17 -08:00
David Lord 49efc44233
clear KeyError in production for Werkzeug 0.15 2019-01-05 12:49:59 -08:00
Jarek Piórkowski 9b0bd91195 Correct tests
We've discovered that passing Unicode in Host actually works, except for
test client limitations on Python 2 - and the only things that don't
work are non-printable characters.
2018-11-13 13:09:16 -05:00
Jarek Piórkowski ed9775fb77 Handle errors during create_url_adapter
If create_url_adapter raises (which it can if werkzeug cannot bind
environment, for example on non-ASCII Host header), we handle it as
other routing exceptions rather than raising through.

ref https://github.com/pallets/werkzeug/issues/640
2018-11-12 16:59:09 -05:00
Dave Chevell e08bcf9f97 Fix #2935: Copy current session object in copy_current_request_context (#2936)
Add session to RequestContext.copy()
2018-11-03 20:32:24 -07:00
garenchan c38499bbf2 ignore colon with slash when split app_import_path
Flask currently supports importing app through a combination of module
path and app variable name, such as '/usr/app.py:my_app'. When the
module path contains a colon, it will conflict with this import way and
a `flask.cli.NoAppException` will be raised.

A file path on a Windows system may contain a colon followed by a slash.
So we solved this problem on Windows by ignoring the colon followed by a
slash when we split app_import_path.

Fix issue #2961.
2018-10-24 23:47:41 +08:00
ThiefMaster 161c43649d Merge branch '1.0-maintenance' 2018-06-14 13:31:40 +02:00
ThiefMaster 50227f0954 Add option to not overwrite debug flag in cli
This is mainly intended for custom CLIs that may load a config file
which already sets the debug flag and does not make use of the `FLASK_*`
env vars at all.
2018-06-14 13:25:05 +02:00
Grey Li 4025e27b57 Add test for routes command when no routes registered 2018-05-31 11:43:51 +08:00
Dilan Coss 8fa3ed13bf details fixed 2018-05-29 09:51:08 -06:00
Dilan Coss 8cdd01ea5d Test added for _AppCtxGlobals __repr__ method 2018-05-28 23:49:06 -06:00
David Lord b51ab3ff2c
encode filenames as ascii instead of latin-1
latin-1 is allowed by pep3333, but that breaks gunicorn
2018-05-28 06:36:47 -07:00
Briehan Lombaard a913b4dafd
SSLContext was added in Python 2.7.9 2018-05-17 06:18:42 -07:00
David Lord b21b4d1608
add more merge cases 2018-05-01 13:29:48 -07:00
Hsiaoming Yang f7a3bdc6db
Fix blueprint route for "" 2018-05-01 14:35:55 +09:00
David Lord 5965cb7e1c
rename to FLASK_SKIP_DOTENV, add docs, test 2018-04-29 14:20:17 -07:00
David Lord 4c8ec8f555
Merge pull request #2739 from pallets/2735-abort-debug
Only trap key errors by default in debug, not all BadRequest errors
2018-04-28 07:01:42 -07:00
David Lord b573a86977
trap key errors in debug, not all 400 errors 2018-04-28 06:51:08 -07:00
David Lord 4d0cdf95e6
merge slashes between blueprint prefix and rule 2018-04-27 12:40:06 -07:00
ThiefMaster 6663bf1f7d Fix registering partials as view functions 2018-04-27 13:44:07 +02:00
Nick Pope fc6a1d9354 Fix default index for TaggedJSONSerializer.register()
Change the default value of ``index`` to ``None`` in ``register()`` so
that it is possible to insert a new tag as the penultimate item in the
order list.
2018-04-19 14:16:11 +01:00
David Lord 1ed756a523
add Response.max_cookie_size config 2018-04-10 11:17:18 -07:00
David Lord ab4142215d
detect UTF encodings when loading json 2018-04-10 09:34:59 -07:00
fphonor 171eb28c95
get_json separate cache depending on silent arg 2018-04-09 02:52:40 -07:00
David Lord 5f42989ce3
don't use Flask(__name__) in conftest 2018-02-28 06:50:49 -08:00
David Lord 401423df06
only strip one slash when registering blueprint
add test and changelog
2018-02-23 15:47:06 -08:00
David Lord 82f0d120de
use subdomain arg in url_map.bind_to_environ
rename new subdomain test, parametrize
test allowing subdomains as well as ips
add subdomain_matching param to docs
add some references to docs
add version changed to create_url_adapter
2018-02-23 08:39:31 -08:00
Armin Ronacher 8cec2010c0
Do not enable subdomain matching by default
Updated tests for new subdomain matching
Added a test to validate matching behavior
2018-02-23 07:53:27 -08:00
David Lord cf5525f98a
add test_cli_runner for testing app.cli commands 2018-02-19 15:34:46 -08:00
David Lord 310fbfcf64
revert copyright year to project start
add copyright header to files
2018-02-08 12:43:30 -08:00
David Lord 03a2996bb8
Merge pull request #2530 from pallets/feature/factory-detection
Improved bad factory error handling
2018-01-28 11:27:07 -08:00
David Lord e21abd9da5
Merge pull request #2607 from FadhelC/SameSite-cookie-feature
Added support for cookie SameSite attribute
2018-01-23 15:20:16 -08:00
David Lord 382b13581e
clean up samesite docs 2018-01-23 15:11:50 -08:00
David Lord 2beedabaaf
add HTTPS support for flask run command 2018-01-23 10:03:53 -08:00
Fadhel_Chaabane a1d9ebe4ab New Feature: Added Support for cookie's SameSite attribute. 2018-01-23 13:57:50 +00:00
David Lord 8bdf820e9b
reset standard os env after each test 2018-01-10 13:53:45 -08:00
Armin Ronacher 2433522d29
Add Support for FLASK_ENV (#2570)
This introduces environments to Flask
2018-01-06 17:07:56 +01:00
David Lord 0a33954555
improve documentation for session attributes
add test for session attributes
2018-01-04 12:56:18 -08:00
David Lord 604cc758fb
use config fixture, get plugin via unregister 2017-12-14 12:20:03 -08:00
Camilo 33fa580947 restore the logging plugin only if it was active to begin with 2017-12-14 09:40:34 -05:00
Camilo e30c39fe78 fix non-passing tests for logging on pytest > 3.3.0 2017-12-14 01:55:22 -05:00
Adrian Moennich 777cc17de3 Fix broken test 2017-11-25 00:53:43 +01:00
Adrian Moennich eb1c2faf9f Merge remote-tracking branch 'upstream/0.12-maintenance' 2017-11-25 00:44:07 +01:00
ThiefMaster c52e1b7388 Fix ValueError for some invalid Range requests
fixes #2526
2017-11-25 00:37:49 +01:00
Armin Ronacher c23a63a185 Improved bad factory error handling 2017-11-25 00:05:57 +01:00
David Lord 5436dddf64
rewrite cli errors
consistent order for arguments to load functions
refactor find_app_by_string to flow better
more cli loader tests
2017-10-10 07:04:53 -07:00
Caratpine 2f57a0b917
Blueprint view function name should not contain dots 2017-10-09 08:12:34 -07:00
Chuan Ma 5888d76342 pytest.yield_fixture deprecated in pytest 3.0+.
It's suggested to use pytest.fixture directly,
and flask already requires 'pytest>=3'.
2017-08-14 10:25:24 -04:00
David Lord 66b1b752da
simplify logging configuration
single default handler and formatter
don't remove handlers
configure level once using setLevel
document logging
reorganize logging tests
2017-07-31 12:49:03 -07:00
David Lord a89bdb3395
prefer the url's scheme over the kwarg
tabs -> spaces
add test
add changelog
2017-07-29 13:03:08 -07:00
David Lord 491d331e6e
load env vars using python-dotenv 2017-07-16 13:37:51 -07:00
David Lord fb845b9032
allow local packages in FLASK_APP
don't require .py extension in FLASK_APP
add tests for nested package loading
parametrize cli loading tests
2017-07-14 19:49:05 -07:00
David Lord 59f7966e31 support passing environ to test client (#2412)
closes #2411
2017-07-13 08:42:53 -07:00
David Lord 9560f22bb6
clean up 2017-07-10 07:10:47 -07:00
Bijan Vakili a417e41d27 Update documentation and regression tests to clarify that Flask.teardown_appcontext() only receives unhandled exceptions 2017-07-07 17:34:44 -07:00
William Horton 5909e26fba Remove unused import from test_basic (#2403) 2017-06-30 17:28:48 +02:00
David Lord 465922e5f1
clean up secret key docs
consistent key across docs and examples
consistent key across tests, set in conftest
2017-06-28 07:58:06 -07:00
David Lord 5bc0d15359
un-deprecate request.json 2017-06-26 09:34:26 -07:00
David Lord 715a9a3e7b
remove deprecated flask.ext 2017-06-26 08:47:28 -07:00
David Lord 723e665004
remove deprecated Request.module 2017-06-26 07:46:33 -07:00
David Lord d63c2bc417
remove deprecated Flask.static_path 2017-06-26 07:45:29 -07:00
David Lord 448368e226
style cleanup
[ci skip]
2017-06-16 06:59:37 -07:00
Miguel Grinberg 7c40aa9e50
Import app from wsgi.py or app.py if FLASK_APP is not defined
Fixes #2376
2017-06-15 11:27:50 -07:00
Eugene M. Kim 63ccdada1b Actually hand-spin and use a tzinfo subclass
This is for Python 2.x compatibility.

Suggested-by: David Lord <davidism@gmail.com>
2017-06-14 14:23:13 -07:00
Eugene M. Kim f803760275 Re-revert to not using pytz
Will spin a tzinfo subclass.
2017-06-14 14:14:18 -07:00
Eugene M. Kim 34050630d6 Skip aware datetime tests if pytz is unavailable 2017-06-14 14:08:42 -07:00
Eugene M. Kim eb9618347c Use pytz again for tests
This is because datetime.timezone is Python 3 only.  The only
alternative would be to hand-spin a datetime.tzinfo subclass, an
overkill.

This reverts commit 0e6cab3576.
2017-06-14 13:57:40 -07:00
Eugene M. Kim 5b38fe2fbe Merge branch 'master' of github.com:pallets/flask into json_encode_non_utc_datetimes 2017-06-14 13:11:53 -07:00
Eugene M. Kim 0e6cab3576 Rewrite test_jsonify_aware_datetimes without pytz 2017-06-14 13:06:26 -07:00
David Lord 4d2a3ab2e0
test no debug flag doesn't reconfigure
test templates_auto_reload property instead of config
use app fixture in test
2017-06-14 12:31:56 -07:00
Eugene M. Kim d75d83defd Add UTs for #2372
test_encode_aware_datetime() fails for non-UTC timezones due to the bug.
2017-06-14 12:22:09 -07:00
David Lord 9e39c506e0
Merge branch 'master' into reload_templates_run_debug 2017-06-14 09:58:33 -07:00
David Lord 5c12acefbb
failing test 2017-06-05 06:14:13 -07:00
David Lord e97253e4c1
clean up JSON code and docs 2017-06-04 11:44:00 -07:00
David Lord dbc70c9274
Merge remote-tracking branch 'remotes/origin/master' into json-mixin 2017-06-04 09:42:39 -07:00
David Lord 5978a0f55f
failing test for streaming session 2017-06-02 11:07:53 -07:00
David Lord fd8b95952c
add tests for flask.json.tag 2017-06-02 10:01:30 -07:00
David Lord ea2e9609bc
Merge branch 'master' into json-object-hook 2017-06-01 06:40:27 -07:00
David Lord 859d9a9d5c
show nice message when registering error handler for unknown code
clean up error handler docs
closes #1837
2017-05-31 18:04:08 -07:00
David Lord 42905b8a55
set description for trap as well as debug
test for key error description
2017-05-29 19:41:07 -07:00
David Lord 045dccaefb
make debugging bad key errors easier
* TRAP_BAD_REQUEST_ERRORS is enabled by default in debug mode
* BadRequestKeyError has the key in the description in debug mode

closes #382
2017-05-29 19:08:25 -07:00
David Lord b8eba0a3fa
use existing response.vary property to set vary header
closes #2345
2017-05-29 10:09:24 -07:00
David Lord a37f675ccb
Merge remote-tracking branch 'origin/0.10-maintenance'
refactor make_test_environ_builder
2017-05-28 07:25:15 -07:00
Kenneth Reitz 090109b637 Merge pull request #2326 from HndrkMkt/#2264-handle-app-factory-in-FLASK_APP
Handle app factory with arguments in FLASK_APP
2017-05-25 14:57:17 -07:00
Kenneth Reitz d911c897ee Merge branch 'master' into master 2017-05-25 14:22:53 -07:00
Hendrik Makait 48c2925664 Factor in code review comments and refactor functions to be more naturally split. 2017-05-25 11:28:20 -07:00
Hendrik Makait 7106fb6357 Handle app factory with arguments in FLASK_APP 2017-05-25 10:11:42 -07:00
Nina Zakharenko e7cd68ba58 Don't overwrite Vary header when setting for cookie access #2317 2017-05-24 20:05:11 -07:00
Christian Stade-Schuldt 4ec1fbc9f5 More DRYing up the test suite (#2325) 2017-05-24 17:27:36 -07:00
David Lord c62b614d9c Merge pull request #2324 from rzelayafavila/2313-refactor-gevent-tests-into-class
Fix for Issue 2313 - refactoring gevent tests into class
2017-05-23 17:31:44 -07:00
David Lord 849fc4b90c Merge pull request #2323 from dawran6/test-fixture
Cleanup test_blueprint.py to use test fixtures
2017-05-23 17:14:57 -07:00
Rene A. Zelaya d29dbe14cf Correcting name of GreenletContextCopying test class (to start with 'Test'), making it extend object, and also having the test methods in it include 'self' as first argument. 2017-05-23 16:51:50 -07:00
Rene A. Zelaya f40617029a Merge remote-tracking branch 'pallets/master' into 2313-refactor-gevent-tests-into-class 2017-05-23 16:45:47 -07:00
Rene A. Zelaya 2eb28165a9 Bundling 'test_greenlet_context_copying' functions into a new class in tests/test_reqctx.py. 2017-05-23 16:45:11 -07:00
Randy Liou c03a82713a Cleanup test_blueprint.py to use test fixtures
Modify several tests to use the app and client test fixtures.
2017-05-23 16:42:14 -07:00
Randy Liou 3fce4898f8 Add test for Blueprint app-wide url processing
The test add coverage for methods: Blueprint.app_url_defaults, and
Blueprint.app_url_preprocessing. This PR increases the coverage of
blueprint module by 2%.
2017-05-23 16:26:53 -07:00
David Lord 39f7aaa416 Merge pull request #2319 from HndrkMkt/#2266-support-create-app-without-script-info
Support `create_app` without script_info or with script_info as named argument
2017-05-23 16:24:29 -07:00
Christian Stade-Schuldt 5b0b9717da DRYing up the test suite using pytest fixtures (#2306)
* add fixtures to conftest.py

* use fixtures in test_appctx.py

* use fixtures in test_blueprints.py

* use fixtures in test_depreciations.py

* use fixtures in test_regressions.py

* use fixtures in test_reqctx.py

* use fixtures in test_templating.py

* use fixtures in test_user_error_handler.py

* use fixtures in test_views.py

* use fixtures in test_basics.py

* use fixtures in test_helpers.py

* use fixtures in test_testing.py

* update conftest.py

* make docstrings  PEP-257 compliant

* cleanup

* switch dictonary format

* use pytest parameterization for test_json_as_unicode
2017-05-23 15:18:39 -07:00
Hendrik Makait ae41df9a77 Check if app factory takes script_info argument and call it with(out) script_info as an argument depending on that 2017-05-23 13:48:42 -07:00
David Lord ce813ae521 Merge pull request #2316 from ka7eh/automatic-options-in-views
Adds provide_automatic_options to Class-based Views
2017-05-23 12:46:31 -07:00
David Lord a037762781 Merge pull request #2311 from bovarysme/use-yield-syntax
Use the yield syntax in pytest's fixtures
2017-05-23 12:00:34 -07:00
kaveh 75f537fb87 Adds provide_automatic_options to Class-based Views 2017-05-23 11:51:13 -07:00
cerickson 4f815015b8 Added support for generic HTTPException handlers on app and blueprints
Error handlers are now returned in order of blueprint:code, app:code,
blueprint:HTTPException, app:HTTPException, None

Corresponding tests also added.

Ref issue #941, pr #1383, #2082, #2144
2017-05-23 10:45:42 -07:00
Florian Sachs 668061a5fc Register errorhandlers for Exceptions
Allow a default errorhandler by registering
an errorhandler for HTTPException

tests included
2017-05-23 10:34:31 -07:00
bovarysme 5963cb5a51 Use the yield syntax in pytest's fixtures 2017-05-23 18:21:29 +02:00
David Lord c8e56d5807 Merge pull request #2303 from MikeTheReader/master
Added tests for make_response and get_debug_flag to improve coverage of helpers.py
2017-05-23 08:34:22 -07:00
MikeTheReader 7c882a457b Replace double quotes with single quotes 2017-05-23 07:59:53 -07:00
MikeTheReader cd412b20dc Parameterize test_get_debug_flag 2017-05-23 07:51:57 -07:00
MikeTheReader fd4a363657 Modifications based on review 2017-05-22 20:49:37 -07:00
Randy Liou d8d712a0de Add coverage for Blueprint teardown request method
Test the following methods in the Blueprint object: teardown_request,
and teardown_app_request.
This PR increases the coverage of blueprint module by 3%.
2017-05-22 16:58:04 -07:00
Randy Liou a690ae27a3 Add coverage for Blueprint request process methods
Add test to cover following methodss to the Blueprint object:
before_request, after_request, before_app_request,
before_app_first_request, after_app_request.
This PR increases the coverage of flask.blueprints by 6%.
2017-05-22 16:58:04 -07:00
MikeTheReader 6f49089a62 Added tests for make_response and get_debug_flag to improve coverage of helpers.py 2017-05-22 16:15:48 -07:00
David Lord 0c94908956 Merge pull request #2297 from HndrkMkt/#2265-auto-detect-create-app-function
Auto-detect create_app() in find_best_app() #2265
2017-05-22 16:13:27 -07:00
Randy Liou 7ce01ab9b4 Add coverage for Blueprint.add_app_template_global
This tests the Blueprint.add_app_template_global mothod, which internally
calls the Blueprint.app_template_global method. The methods are used to
registering a function to the jinja template environment.
This PR increases the test coverage for module flask.blueprint by 4%.
2017-05-22 14:33:58 -07:00
David Lord e706b5e544 Merge pull request #2298 from dawran6/test-bp-context
Add coverage for Blueprints.(app_)context_processor
2017-05-22 14:01:59 -07:00
Randy Liou 136dbf7de0 Add coverage for Blueprints.(app_)context_processor
Test both context_processor and app_context_processor functions.
Two context parameters are added into the context: one added to
the blueprint locally; another added to the app globally. The test
asserts the behaviors in both blueprint scope and the app scope.
The coverage for flask.blueprints is increased by 3%.
2017-05-22 13:09:22 -07:00
Hendrik Makait ced719ea18 Auto-detect create_app and make_app factory functions 2017-05-22 12:30:18 -07:00
Randy Liou 9fddecd4d9 Add coverage for Blueprint.app_errorhandler
This test case registers an application-wise error handler from
a Blueprint. Verifies the error handler by aborting the flask app
from the application itself as well as from another registered
Blueprint.
2017-05-22 12:00:04 -07:00
David Lord 5d9dd0b379
set session accessed for setdefault 2017-05-20 13:00:17 -07:00
David Lord e2f4c0ac16
Merge branch 'master' into vary-cookies 2017-05-19 09:44:06 -07:00
David Lord f7c35bf0d5 safe_join on Windows uses posixpath
fixes #2033
closes #2059
2017-05-16 08:34:37 +02:00
David Lord 2a65794306
safe_join on Windows uses posixpath
fixes #2033
closes #2059
2017-05-15 16:58:01 -07:00
David Lord f75ad9fca2
refactor session cookie domain logic
cache result of session cookie domain
add warnings for session cookie domain issues
add changelog
2017-05-13 21:59:00 -07:00
David Lord 7ad79583b9
add sort by match order
sort by endpoint by default
combine sort flags
sort methods
ignore HEAD and OPTIONS methods by default
rearrange columns
use format to build row format string
rework tests
add changelog
2017-04-26 10:26:59 -07:00
David Lord 717e45ab15
Merge branch 'master' into routes-command 2017-04-25 13:13:10 -07:00
David Lord 697f7b9365
refactor make_response to be easier to follow
* be explicit about how tuples are unpacked
* allow bytes for status value
* allow Headers for headers value
* use TypeError instead of ValueError
* errors are more descriptive
* document that view must not return None
* update documentation about return values
* test more response types
* test error messages

closes #1676
2017-04-25 08:30:48 -07:00
David Lord 46f83665ef
clean up blueprint json support
add changelog for #1898
2017-04-24 10:16:50 -07:00
David Lord 74b3f7e04c Merge pull request #1898 from RaHus/per_blueprint_jsoncoding_#1710
Per blueprint jsoncoding #1710
2017-04-24 10:16:20 -07:00
David Lord 13754b6d11
ensure error while opening session pops context
errors will be handled by the app error handlers
closes #1538, closes #1528
2017-04-22 13:57:04 -07:00
David Lord 0d9d3d8f92
Merge branch 'master' into figome-multiple-inheritance 2017-04-21 10:33:29 -07:00
David Lord 97e2cd0a5a
update changelog
move test next to existing test, rename
reword / reflow param doc
2017-04-21 07:26:30 -07:00
David Lord 8ad4f476aa
Merge branch 'master' into jrmccarthy-master 2017-04-21 07:03:46 -07:00
David Lord e50767cfca
add test for build error special values 2017-04-20 08:52:37 -07:00
David Lord f0c714a01b Merge pull request #1886 from dawran6/test_bp_endpoint_dec
Enhance code coverage for Blueprint.endpoint
2017-04-14 09:22:12 -07:00