Commit graph

74 commits

Author SHA1 Message Date
Matěj Volf
ce77d5a4e9 refer to encoder instead of decoder 2020-10-07 08:06:29 -07:00
Bogdan Opanchuk
849cf2c2a9 Break reference cycle created by default in Flask instances.
Flask instances with static folders were creating a reference cycle
via their "static" view function (which held a strong reference back
to the Flask instance to call its `send_static_file` method). This
prevented CPython from freeing the memory for a Flask instance
when all external references to it were released.

Now use a weakref for the back reference to avoid this.

Co-authored-by: Joshua Bronson <jab@users.noreply.github.com>
2020-10-03 10:05:05 -04:00
ongopongo
ef43c92c39 fix typo in flask shell help (#3744) 2020-08-26 09:20:21 -07:00
WolframAlph
2f1e1c4686 fixed #3738 typo in src/flask/blueprints.py 2020-08-23 08:56:24 +02:00
yk396
a37cbe4fbb extract common Flask/Blueprint API to Scaffold base class
Co-authored-by: Chris Nguyen <chrisngyn99@gmail.com>
2020-08-01 07:45:58 -07:00
David Lord
8b9128ee06 cleaner message when CLI can't load app
When loading the app fails for the --help command, only the error
message is shown, then the help text. The full traceback is shown for
other exceptions. Also show the message when loading fails while
getting a command, instead of only "command not found". The error
message goes to stderr to match other error behavior, and is in red
with an extra newline to make it more obvious next to the help text.

Also fixes an issue with the test_apps fixture that caused an imported
app to still be importable after the test was over and the path was
reset. Now the module cache is reset as well.
2020-07-30 18:36:55 -07:00
Christopher Nguyen
95653896a4 change make_response to use headers.update 2020-07-23 16:53:39 -07:00
Joshua Bronson
06f7f34d76 Merge pull request #3560 from greyli/fix-env-chdir
Stop change CWD to .env/.flaskenv location
2020-07-18 13:14:09 -04:00
Armin Ronacher
40d6d107c5 Some small doc fixes 2020-07-08 15:53:43 +02:00
Joshua Bronson
f81846c68b Restore support for using pathlib.Path for static_folder.
* No longer causes AttributeError: 'PosixPath' object has no
  attribute 'rstrip'.

* This was broken by e6178fe489
  which was released in 1.1.2.

* Add a regression test that now passes.

See #3557.
2020-07-06 08:55:19 -04:00
Grey Li
62c582e19b Stop change CWD to .env/.flaskenv location 2020-07-05 09:37:03 +08:00
jackwardell
148c89bccd add assert message for errorhandler exception type 2020-04-16 10:49:42 -07:00
David Lord
042754ba4a use ast to parse FLASK_APP
enables keyword arguments to factory functions
2020-04-07 17:54:51 -07:00
David Lord
f2a8087cf5 deprecate passing script_info to factory 2020-04-07 15:54:36 -07:00
David Lord
23fb6f8065 update json docs 2020-04-07 13:37:14 -07:00
David Lord
1039d7834b deprecate JSON encoding options
make consistent with built-in json module
2020-04-07 12:32:27 -07:00
David Lord
187cfe90b8 remove simplejson
- remove encoding detection backport, json.loads supports it directly
- use str.translate instead of multiple str.replace
2020-04-07 09:55:39 -07:00
David Lord
9594326577 move package metadata to setup.cfg 2020-04-04 14:50:21 -07:00
David Lord
1de5873d66 remove unused ref directives
replace page refs with doc directives
2020-04-04 12:57:14 -07:00
David Lord
296ef35943 remove unused module docstrings 2020-04-04 12:28:08 -07:00
David Lord
f5038c4c39 f-strings everywhere 2020-04-04 12:10:00 -07:00
David Lord
67bb43b738 apply pyupgrade 2020-04-04 12:10:00 -07:00
David Lord
1e5e3aae8a remove more compat code 2020-04-04 12:10:00 -07:00
David Lord
24723fa6e8 remove _compat module 2020-04-04 12:10:00 -07:00
David Lord
8cf6480f91 remove deprecated code 2020-04-04 12:10:00 -07:00
David Lord
8433de53c9 drop support for Python 2.7 and 3.5 2020-04-04 12:09:55 -07:00
David Lord
c0c76bd651 remove Python 2 from docs 2020-04-04 12:05:44 -07:00
David Lord
793bff721a Merge branch '1.1.x' 2020-04-03 10:25:51 -07:00
David Lord
dbdc26f2dc release version 1.1.2 2020-04-03 10:10:38 -07:00
David Lord
39d2597028 update deprecation versions 2020-04-03 10:02:40 -07:00
Jeenu Viswambharan
7ddc55a3b3 clarify static_folder is relative to root_path 2020-04-03 07:28:44 -07:00
Shanavas M
e647a4a07a Update deprecated for config.from_json 2020-03-18 12:37:51 +05:30
kevinanew
243c08238b refactor variable choices into if blocks 2020-03-11 07:24:38 -07:00
David Lord
376a64137c Merge remote-tracking branch 'origin/1.1.x' 2020-02-15 10:40:32 -08:00
Frost Ming
fe392e7884 Handle different sep across os 2020-02-12 13:17:03 +08:00
frostming
c4de6a0bfc strip the ending slash for static_url_path 2020-02-10 18:19:25 -08:00
David Lord
d1ffe44185 cli checks for cryptography library 2020-02-10 17:34:19 -08:00
Marc Hernandez Cabot
ed93b738ed fix docstring and remove redundant parentheses 2020-02-10 17:03:52 -08:00
raymond-devries
5ffacfc010 Feature request #3445. 2020-02-10 13:09:53 -08:00
David Lord
17cbfb2df5 next version 1.2.0 2020-02-09 15:20:23 -08:00
Adrian
2f8157bc9e Remove comment about extension backwards compat
0.7 was a long time ago; there's no reason for extension to supports such old versions.
2019-11-25 00:38:50 +01:00
Grey Li
66a28f0f28 Replace old pocoo links everywhere
pocco.org -> palletsprojects.com
2019-11-19 09:32:35 -08:00
David Lord
46c3d4656d send_file doesn't allow StringIO 2019-11-19 08:52:12 -08:00
David Lord
050efbf013 Merge pull request #3425 from homeworkprod/patch-1
Update `versionadded` for `Config.from_file`
2019-11-18 18:23:39 -08:00
David Lord
c71de17d1d rewrite the development server docs 2019-11-18 18:02:12 -08:00
David Lord
578592c01e lazy load app on reload only 2019-11-18 17:54:46 -08:00
Jochen Kupperschmidt
bf13ec0142 Update versionadded for Config.from_file
According to the change log at https://github.com/pallets/flask/blob/master/CHANGES.rst, the release `Config.from_file` will be published with is now 2.0.0 rather than 1.2.0.
2019-11-13 23:13:56 +01:00
David Lord
a620f1c9c8 clean up config.from_file docs 2019-10-18 09:24:58 -07:00
pgjones
35627192e7 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
940fa38c28 get_cookie_name in SessionInterface for easier overriding in SecureCookieSessionInterface 2019-10-12 19:12:27 -07:00