Commit Graph

329 Commits

Author SHA1 Message Date
Mac Newbold
efe447fb5f Fix SQLAlchemy recording warning for versions >= 3 (#233) 2024-03-20 09:28:47 -06:00
Jonty Wareing
9656a2cf33 Fix SQLAlchemy recording warning for versions >= 3
Since SQLAlchemy 3.0 `SQLALCHEMY_RECORD_QUERIES` is no longer
automatically enabled when Flask is running in debug or testing mode so
the debug toolbar warning will never be shown.

https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/config/#flask_sqlalchemy.config.SQLALCHEMY_RECORD_QUERIES
2024-03-20 14:25:36 +00:00
Mac Newbold
9b63ad1837 Support applications using flask.copy_current_request_context (#231) 2024-01-17 09:40:50 -07:00
Marc Aymerich Gunern
765f22126e Handle cases when debug toolbar has not been installed 2024-01-11 18:06:28 +00:00
Marc Aymerich Gunern
d4a8cc963e Support applications using flask.copy_current_request_context 2024-01-09 13:50:02 +00:00
Mac Newbold
b7f5a725cd Add init_app() method to DebugPanel base class (#95) 2023-12-20 09:35:17 -07:00
Malthe Jørgensen
5bf5e093bb [Add] init_app()-method to DebugPanel base class
Adds a method `DebugPanel.init_app()` that gets called from
`DebugToolbar.init_app()`.

This allows DebugPanels to register their own routes, and do setup work
that should go across requests (as opposed to per-request setup) and
needs access to the Flask `app`-object.
2023-12-15 10:14:33 +01:00
Mac Newbold
719fe02df5 Add option to dump profiler stats (#204) 2023-12-13 10:49:10 -07:00
Dosenpfand
f18bcc708a Remove trailing whitespaces 2023-12-13 10:47:24 -07:00
Dosenpfand
95c2b86bcd Add profile dump stats option 2023-12-13 10:47:24 -07:00
Mac Newbold
b03a2e6fb3 Require Flask >= 2.2.0 (#224) 2023-12-11 11:27:45 -07:00
Jeff Widman
1c39a9ce47 Require Flask >= 2.2.0, Python >= 3.7
Require Flask >= `2.2.0`.

I'm comfortable going up to requiring `3.x`, but when I grep'd for
places we use older Flask constructs, this was all I found.

So for now no need to jump further.

Flask `2.2.0` requires Python >= `3.7`, so also dropped older pythons.
2023-12-11 11:25:52 -07:00
Mac Newbold
8c8b2bb35c Add minimal test without extra deps (#230) 2023-12-10 20:18:10 -07:00
Grey Li
a2e773124f Add minimal test without extra deps
To prevent issues like https://github.com/pallets-eco/flask-debugtoolbar/pull/225,
This PR add a minimal test that no extra deps are involved, it only install
the package, then try to import the extension class.

fixes #226
2023-12-10 12:54:29 +08:00
Jeff Widman
2f8ec9027b Bump to version 0.14.1 (#227) 0.14.1 2023-12-07 09:31:28 -08:00
Grey Li
ab9a41df6a Add the missing install requirement packaging (#225)
The `packaging` lib is not listed in the `install_requires` list.

https://github.com/greyli/flask-extension-status/actions/runs/7129071225/job/19412328108

```
Run python -c "from flask import Flask; app = Flask(__name__); from flask_debugtoolbar import DebugToolbarExtension; DebugToolbarExtension(app)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flask_debugtoolbar/__init__.py", line 6, in <module>
    from packaging import version as version_builder
ModuleNotFoundError: No module named 'packaging'
Error: Process completed with exit code 1.
```
2023-12-07 08:32:29 -08:00
Jeff Widman
2b1e7d9907 Bump version to 0.14.0 (#223)
We need this to land before we can push a release...
0.14.0
2023-12-06 16:48:19 -08:00
Mac Newbold
d0360218fd Drop CHANGES.rst in favor of GitHub Releases (#198) 2023-11-21 08:26:28 -07:00
Mac Newbold
e9fd3072a9 Merge branch 'master' into switch-to-using-github-auto-generated-releases 2023-11-21 08:24:53 -07:00
Grey Li
1aedfb0e2e Use standard Python gitignore file (#220)
Created from https://github.com/github/gitignore/blob/main/Python.gitignore
2023-11-20 18:29:03 -08:00
Grey Li
e6ae9d0288 Fix the test for basic app (#221)
1. Update the test app

If I understand correctly, the debug toolbar will only be enabled if `app.debug` is `True`. So I added the `DEBUG=True` to the test app.

Related code: 2b8bf9cc44/src/flask_debugtoolbar/__init__.py (L114)

2. Update the `src/flask_debugtoolbar/__init__.py`

Fix the two if statements to prevent the following errors:

```
>       if 'gzip' in response.headers.get('Content-Encoding'):
E       TypeError: argument of type 'NoneType' is not iterable
```

Since the `response.headers.get('Content-Encoding')` could be None.

With this PR, all the tests will be passed. The failed style checker will be fixed in #219
2023-11-20 18:21:38 -08:00
Grey Li
62ce443f8b Fix lint issues and lint config (#219)
For the two ignored rules:

- E731: It's OK to use lambda
- W504: W503 and W504 are conflicts with each other, we need to disable one of them.
2023-11-20 10:59:24 -08:00
Grey Li
2b8bf9cc44 Remove the use of before_first_request (#218) 2023-11-17 22:12:44 +08:00
Grey Li
42d859534a Remove the use of before_first_request 2023-11-17 22:09:25 +08:00
Grey Li
f959951185 Fix tox and GitHub actions settings (#217)
* Remove the branch constraint for pull request triggering
* Use Python 3.12 for main tests
* Use `ubuntu-20.04` for Python 3.6 since it's been removed in `ubuntu-latest`
* Remove Python 2.7 since it's not supported by GitHub Actions anymore (https://github.com/actions/setup-python/issues/672)
* Add the missing `setup-python` step
* Merge the `pip install` commands
2023-11-16 14:41:30 -08:00
dadavec
e1c8704444 Remove deprecated charset property from process_response content crafting (#211)
The `Request.charset` property is deprecated since Werkzeug version 2.3. It was removed in Werkzeug 3.0. Request data must always be UTF-8.

https://werkzeug.palletsprojects.com/en/2.3.x/wrappers/#werkzeug.wrappers.Request.charset
2023-11-15 19:53:02 -08:00
Mac Newbold
8a4cfa5e3c No need to specify custom default value if key not found (#210) 2023-11-15 17:30:39 -07:00
Grey Li
51d105afad Set up GitHub actions to replace Travis (#215) 2023-11-16 02:10:00 +08:00
Grey Li
15192f19e0 Set up github actions 2023-11-15 22:28:43 +08:00
Jeff Widman
5712e57869 No need to specify custom default value if key not found
The `''` arg specifies a custom default value if the key isn't found. However, the default of `None` works fine for boolean testing:

```python
>>> 'gzip' in [None]
False
```

I missed this when I originally reviewed https://github.com/pallets-eco/flask-debugtoolbar/pull/154.
2023-10-13 13:39:35 +00:00
Hiromasa Ihara
9571d06df5 fix: drop response.charset because charset deprecated (#206)
I took a quick peek at upstream to see if this has any backwards-breaking issues whereby we'd need to check the `werkzeug` version, but from my reading it looks it should be fine most of the time.

Also, this was deprecated back in April's `2.3.0` release and then removed in the recent `3.0.0` release, so I suspect most of our userbase will have already migrated to those versions.

Given this lib is a dev-tooling library not typically used in production, I'm not too worried about ensuring we support the 0.01% case where someone is using an old version of `werkzeug` + a custom charset.

More context:
* https://github.com/pallets/werkzeug/issues/2602
* https://github.com/pallets/werkzeug/pull/2641
* https://github.com/pallets/werkzeug/pull/2768
2023-10-13 06:35:25 -07:00
Nick Janetakis
3b25e114e9 fix: use urllib.parse.quote_plus and drop werkzeug.urls.url_quote_plus (#207) 2023-10-06 18:19:51 -04:00
Hiromasa Ihara
f7ae3fd591 fix: use urllib.parse.quote_plus and drop werkzeug.urls.url_quote_plus 2023-10-01 16:03:15 +09:00
Hiromasa Ihara
ce02d2da3c fix: migrate from deprecated flask.Markup to markupsafe.Markup (#203) 2023-05-24 10:22:56 -07:00
Jeff Widman
bd346a0fc1 Drop CHANGES.rst in favor of GitHub Releases
I started to cut a new release but realized it's a bit painful that we
are currently maintaining both a `CHANGES.rst` file and also tagging
releases in GitHub releases UI.

For a busy project, maintaining a dedicated changelog makes sense... but
the reality is this project is in maintenance mode, and we the
maintainers are more likely to cut releases when they're easy/low
friction. Since GitHub very nicely has the "Auto-generate-release-notes"
button, let's just use that.

I considered copy/pasting the results from that to `CHANGES.rst`, but
even that feels like a waste of time.
2023-01-17 20:05:25 +00:00
Jeff Widman
ed8243e17e Point URLs at pallets-eco/flask-debugtoolbar (#197) 2023-01-17 08:16:30 -08:00
Nick Janetakis
02c99a7b64 Fix Flask SQLAlchemy quickstart link (#196) 2022-12-27 08:10:52 -05:00
Francesco Frassinelli
96514793e4 Update sqlalchemy_error.html 2022-12-27 13:10:16 +01:00
Francesco Frassinelli
ec8cc3a0ba Fix Flask SQLAlchemy quickstart link 2022-12-27 10:54:53 +01:00
Jeff Widman
e3c8ab0ca2 Point at new location of django-debug-toolbar (#189) 2022-11-02 12:53:49 -07:00
Jeff Widman
fefb32b04d Fix outdated docs links (#187) 2022-11-02 12:51:06 -07:00
Nick Janetakis
b5a7c032ab Merge pull request #186 from Dosenpfand/flask-sqlalchemy-v3
Flask-SQLAlchemy 3 compatibility
2022-10-28 11:41:38 -04:00
Dosenpfand
6af24f5f44 Do not explicitly set SQLALCHEMY_TRACK_MODIFICATIONS for test/example 2022-10-28 11:28:50 +02:00
Dosenpfand
b4a197f87f Enable query recording if debug is active, remove warning 2022-10-26 14:31:14 +02:00
Dosenpfand
15b6fee933 Fix typo 2022-10-24 21:29:59 +02:00
Dosenpfand
9e03576c94 Keep config for flask_sqlalchemy < 3 2022-10-24 19:35:47 +02:00
Dosenpfand
bfa48c5a2c Add support for flask_sqlalchemy >= 3.0.0 2022-10-24 18:59:28 +02:00
sur.la.route
890fd9c7fb updated to work with flask 2.2+ (#183)
Replaced `_request_ctx_stack.top` with `request_ctx` per https://github.com/pallets/flask/pull/4682

This checks the version of `flask` and only does the switcheroo on newer versions of flask...
2022-10-04 16:20:14 -07:00
Hugo van Kemenade
42a9651950 Replace deprecated threading.currentThread with threading.current_thread (#179) 2022-09-18 14:08:43 -07:00
Nick Janetakis
ff01910f6a Merge pull request #182 from caffeinatedMike/master
Fixed scrollbar issues
2022-08-18 11:20:45 -04:00