test: change code to adapt to new werkzeug client
fix: avoid setting charset
utf8 is default and assumed now by werkzeug, setting this manually is
deprecated.
fix: use string instead of bytes for setting headers
DeprecationWarning: Passing bytes as a header value is deprecated and will not be supported in Werkzeug 3.0.
12:23:34 web.1 | response.headers["X-Page-Name"] = path.encode("ascii", errors="xmlcharrefreplace")
* refactor: replace `imaghdr` with `filetype`
```
11:52:06 worker.1 | /home/ankush/benches/develop/apps/frappe/frappe/core/doctype/file/utils.py:2: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13
```
* feat: improved extension guessing using filecontent
```
File "/home/ankush/benches/develop/apps/frappe/frappe/database/database.py", line 920, in get_default
d = self.get_defaults(key, parent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ankush/benches/develop/apps/frappe/frappe/database/database.py", line 936, in get_defaults
defaults = frappe.defaults.get_defaults_for(parent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ankush/benches/develop/apps/frappe/frappe/defaults.py", line 222, in get_defaults_for
.run(as_dict=True)
^^^^^^^^^^^^^^^^^
File "/home/ankush/benches/develop/apps/frappe/frappe/query_builder/utils.py", line 85, in execute_query
return frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ankush/benches/develop/apps/frappe/frappe/database/database.py", line 264, in sql
self.log_query(query, values, debug, explain)
File "/home/ankush/benches/develop/apps/frappe/frappe/database/mariadb/database.py", line 203, in log_query
self.last_query = query = self._cursor._last_executed
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Cursor' object has no attribute '_last_executed'. Did you mean: '_check_executed'?
```
We depend on it for escaping. Currently this works because of indirect
dependencies:
```
λ pipdeptree -p MarkupSafe --reverse
MarkupSafe==2.1.1
- Jinja2==3.1.2 [requires: MarkupSafe>=2.0]
- frappe==15.0.0.dev0 [requires: Jinja2~=3.1.2]
- Werkzeug==2.2.2 [requires: MarkupSafe>=2.1.1]
- frappe==15.0.0.dev0 [requires: Werkzeug~=2.2.2]
```
[skip ci]
- Switch to Pydantic which is under continuous development and can
support more types
- Equivalent Pydantic API will try to transform data if possible
- The previous point makes it such that we don't need to explicitly try
to parse each stringified int in app code since Pydantic can do this
- Drop typeguard since it did not handle 3.10+ native typing definitions
- Run type validations if annotations exist for whitelisted functions
- Run validations only on function calls in presense of frappe.local.request
In action:
```bash
> curl -H 'Content-Type: application/json' 'http://photos:8000/api/method/frappe.handler.download_file' -d '{"file_url": ["!=", "gavin.jpg"]}'
```
Note: This ignores stringified or ForwardRef types. If you want types to
be validated make sure they are not imported under `if TYPE_CHECKING`
blocks
* test: fix flaky RQ job tests
Sometimes stop_job doesn't succeed and causes tests to timeout. Reduced
sleep time to avoid this in tests. We are still testing all the
important features - monitoring.
* build(deps): Bump RQ to latest version
Minor bugfixes that affect us
ref: https://github.com/rq/rq/releases
* test: sanity tests for scheduled job types
* test(test_runner): dont set bench_id globally
* refactor: stop_job shouldn't throw error
The intention of use here is to stop stuck jobs or long running jobs, if
for some reason they were stopped by the time command gets executed,
there's no need to throw error.
Werkzeug reloader is right now using an inefficient `stat` based reloader which is horrible on large codebases with low-powered devices.
Difference:
- `stat` based reloader basically checks each and every file if they have changed or not.
- watchdog subscribes to platform specific change events on kernel (like kqueue, fsevents or inotify )
Given how widespread PY310's usage has become, and how we're just a
few months away from PY311 major release. This is a slightly late
bumping but necessary to ensure smoother updates & maintenance for
Frappe, ERPNext & other apps in the coming years. Almost all people
who participated in the pool from the community as well as Frappe team
voted (via active telegram groups) PY310 as their preferred minimum
requirement for v14.