Commit graph

3290 commits

Author SHA1 Message Date
Akhil Narang
8d001e530c
Merge pull request #24448 from akhilnarang/fix-failed-decryption-file-name
fix(decrypt): wrap the yield and cleanup code in try-finally
2024-01-19 15:51:14 +05:30
mergify[bot]
483fcf89c3
Merge pull request #24428 from blaggacao/chore/cleanup-frappe-connect
chore: cleanup frappe connect (I/II)
2024-01-18 12:15:42 +00:00
Akhil Narang
39be50c773
fix(decrypt): wrap the yield and cleanup code in try-finally
Without this, the cleanup code won't run after if `sys.exit()` is called when we yield

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-18 17:37:23 +05:30
Ankush Menat
ee6743c26b
fix: avoid mutating list while iterating over it (#24438) 2024-01-18 05:44:30 +00:00
Ankush Menat
f36a753c5a
refactor: Start sentry before freezing gc and use in pool (#24436)
- Workerpool wasn't using sentry
- Sentry was started after freezing GC which causes sentry imports to
  not be shared. Freeze GC after most memory intensive work is done.
2024-01-18 05:34:34 +00:00
David Arnold
d87092936f
chore: simplify frappe.connect & require explicit site initialization 2024-01-17 16:53:30 +01:00
Ankush Menat
afef4b8f30
fix: add short timeout to gravatar (#24414)
closes https://github.com/frappe/frappe/issues/24377
2024-01-17 09:08:00 +00:00
Ankush Menat
307da3097f
Merge pull request #23329 from akhilnarang/allow-setting-db-username
refactor: allow setting a db user name different from the database name
2024-01-16 17:46:03 +05:30
Akhil Narang
92326d143d
fix(sentry): set scope for background jobs
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 16:26:48 +05:30
Akhil Narang
3ccdbfbde0
fix: drop a fallback
Had some issues earlier - seems to be resolved now

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 13:01:13 +05:30
Akhil Narang
c721fcf8c4
refactor: allow setting a db user name different from the database name
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 12:35:01 +05:30
Akhil Narang
235be44d7a
fix: add a check for gpg existing
Encrypted backup/restores just fail without a clear error message if gpg is missing

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-15 17:52:51 +05:30
barredterra
52f6c24982 refactor: check latest github release 2024-01-14 16:46:07 +01:00
Ankush Menat
b3eaec4347
fix: misc (#24303)
* fix(DX): improve logging in various places

* fix(ux): misc RQ worker and job fixes
2024-01-13 10:54:38 +05:30
Akhil Narang
5c90e151ab
Merge pull request #24246 from akhilnarang/fix-file-download
fix(response): fixup non-ASCII character filenames
2024-01-11 16:15:23 +05:30
Ankush Menat
0a38fb0813 fix: skip exc without exc id 2024-01-11 13:09:43 +05:30
Ankush Menat
1f6201b4af feat: lazy global translated strings 2024-01-10 21:28:01 +05:30
Akhil Narang
e622198bab
fix(response): fixup non-ASCII character filenames
This was previously only handled for binary files

Werkzeug crashes otherwise:

17:54:40 web.1         | Traceback (most recent call last):
17:54:40 web.1         |   File "/home/akhil/frappe/frappe-bench/env/lib/python3.11/site-packages/werkzeug/serving.py", line 362, in run_wsgi
17:54:40 web.1         |     execute(self.server.app)
17:54:40 web.1         |   File "/home/akhil/frappe/frappe-bench/env/lib/python3.11/site-packages/werkzeug/serving.py", line 326, in execute
17:54:40 web.1         |     write(data)
17:54:40 web.1         |   File "/home/akhil/frappe/frappe-bench/env/lib/python3.11/site-packages/werkzeug/serving.py", line 266, in write
17:54:40 web.1         |     self.send_header(key, value)
17:54:40 web.1         |   File "/usr/lib/python3.11/http/server.py", line 526, in send_header
17:54:40 web.1         |     ("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
17:54:40 web.1         | UnicodeEncodeError: 'latin-1' codec can't encode characters in position 43-52: ordinal not in range(256)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-10 18:44:51 +05:30
Ankush Menat
9620a3c596 Merge branch 'develop' into po-translation 2024-01-10 16:17:47 +05:30
Akhil Narang
9586b5f18a
fix(execute_in_shell): run explicitly in bash
`pipefail` isn't supported in sh, bash is common enough to be installed nearly everywhere

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-04 19:07:28 +05:30
Akhil Narang
58a13cfb3e
refactor: set pipefail in shell before running piped backup/restore commands
Drop the complicated logic behind storing pid and killing process if first stage of pipe fails

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-04 18:41:37 +05:30
Raffael Meyer
edac879d7e
refactor!: remove unused parameter from rebuild_tree, add type hints (#24123)
* refactor!: remove unused parameter from rebuild_tree, add type hints

* fix: remove parent_field parameter from backend calls
2024-01-04 18:13:12 +05:30
Akhil Narang
6acbdbfc97
Merge pull request #24103 from akhilnarang/background-jobs-recorder
feat: support background jobs in recorder
2024-01-04 17:08:27 +05:30
Raffael Meyer
dd690c79d1
fix: use correct parent field in rebuild_tree() (#24107)
* fix: use correct parent field in rebuild tree

* refactor!: ignore parent_field parameter to rebuild_tree
2024-01-04 16:07:39 +05:30
Akhil Narang
35ea093b51
feat: support background jobs in recorder
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-04 15:51:26 +05:30
Akhil Narang
da8e88e66c
feat(sentry): log request json body / form data
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-02 11:39:16 +05:30
Ankush Menat
b71d01e1b4 fix: View logging fails if no referrer
```
AttributeError: 'NoneType' object has no attribute 'startswith'
  File "frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
  File "frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
  File "frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "__init__.py", line 1680, in call
    return fn(*args, **newargs)
  File "frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "frappe/website/doctype/web_page_view/web_page_view.py", line 58, in make_view_log
    if not frappe.utils.is_site_link(path):
  File "frappe/utils/data.py", line 2488, in is_site_link
    if link.startswith("/"):
```
2024-01-01 19:15:25 +05:30
Ankush Menat
585200988b feat: simple procline for scheduler
Makes it easy to tell if scheduler is for some reason "stuck".
2023-12-29 14:39:40 +05:30
Ankush Menat
31d72c33b4
chore: use site as "user" (#24026)
For us, a user is single site. This is because logic like "issue affects
more than 1 user" only makes sense for site. Same client/server script
can affect multiple user on same site but it's not a useful error for
us.


[skip ci]
2023-12-29 11:55:26 +05:30
Ankush Menat
d423d2ace5
fix(DX): filter version logs with changes to field (#24023)
Diff view shows all versions. E.g. if you enable/disable a script it
shows up in possible diff targets. This PR filters versiont to only show
the ones that have the field changed somehow.
2023-12-29 06:03:14 +00:00
Ankush Menat
00f20f43c6
build: add setproctitle as dependency (#24007)
* build: add setproctitle as dependency

RQ and other tools use it to automatically set a useful proc title

* ci: print all bench logs after running tests

This can help reveal failures from background jobs etc
2023-12-28 20:50:27 +05:30
Ankush Menat
4a8fb6c43c style: format 2023-12-28 19:16:11 +05:30
Ankush Menat
9b458ad354
Merge pull request #23835 from akhilnarang/sentry-sync-fc
refactor(sentry): sync up with FC implementation
2023-12-28 17:38:06 +05:30
mergify[bot]
a9bb994f15
fix!: deterministic fixture import order (#22210)
* feat: #20753 fixture export prefix and fixture import order

(cherry picked from commit 6a9c56a568e4ccf181fe9cb4153d0b9e4f02ac3d)

* refactor: clarify prefix logic, see c4866921df (r1196249038)

(cherry picked from commit cd2519e71e5545bd4c706369df3ea05843a0bfd9)

* style: format

* refactor: conditionally sort documents when importing

* refactor: simplify code

* feat: Unittest as requested in https://github.com/frappe/frappe/pull/22210#discussion_r1331587501

---------

Co-authored-by: To Finke <tom.finke@webterra.de>
Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-12-28 14:24:45 +05:30
Revant Nandgaonkar
37803a00d4
fix: strip exc from json response if traceback not allowed (#23989)
* fix: strip exc from json response if traceback not allowed

* fix: use pop instead of del to avoid key error

* fix: Avoid showing exc when traceback is disabled

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-12-28 10:45:06 +05:30
Akhil Narang
d5d35704d8
feat(sentry): skip validation errors
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-27 18:43:33 +05:30
Akhil Narang
64b63d5969
fix(sentry): don't set context if not enabled
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-27 11:38:01 +05:30
barredterra
d384bb4506 Merge remote-tracking branch 'upstream/develop' into po-translation 2023-12-26 16:45:05 +01:00
Akhil Narang
067104ca9c
refactor(sentry): sync up with FC implementation
Co-authored-by: Aditya Hase <aditya@adityahase.com>
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 12:30:10 +05:30
Akhil Narang
7f433b84af
feat: allow creating a backup with the older metadata style
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
a06e402f38
refactor: use a function with context manager for backup decryption
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
cb7c0e653c
fix(Backup): automatically rollback decryption when object is being deleted
This allows us to not have to call it everytime before returning

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:08:48 +05:30
Akhil Narang
3b0f6de883
perf: don't extract backup files unless required
Read from the gzipped file wherever possible

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:08:48 +05:30
Ankush Menat
0fd6f5eed7
Merge pull request #23827 from frappe/api-docs
docs: add Python API missing docstrings / type hints
2023-12-21 12:13:05 +05:30
Hussain Nagaria
369844a9cb fix: type hint 2023-12-20 14:09:01 +05:30
Hussain Nagaria
ecdd7b3e37 docs: consistency 2023-12-20 14:02:32 +05:30
Ankush Menat
3d3f982cbe
Merge pull request #23873 from frappe/img_fix
fix: ignore and gracefully handle img optimization failure
2023-12-20 13:12:22 +05:30
Akhil Narang
39359f9793
fix(sentry): name field is ignored
Only `id`, `username`, `email`, and `ip_address` are accepted here

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-20 12:43:42 +05:30
Ankush Menat
3524cae48e fix: ignore and gracefully handle img optimization failure
PIL doesn't handle ALL image types. E.g. HEIC fails with bad error.
2023-12-20 12:25:56 +05:30
Hussain Nagaria
0df45daacd docs: get_number_format_info 2023-12-19 12:17:00 +05:30