Commit graph

330 commits

Author SHA1 Message Date
David Arnold
2f559e0fa9
chore: make the type clear (#28524) 2024-11-19 22:40:26 +00:00
David Arnold
8d6f8bce01
chore(typing): add some more typing to frappe.__init__ (#28215) 2024-10-21 11:30:11 +00:00
David Arnold
8cfeb156df
devx: add deprecation dumpster (#27887)
* feat: Add deprecation_dumpster.py file

* docs: add jovial and jocose docstring for frappe/deprecation_dumpster.py

* refactor: fill the dumpster with its own kind

* refactor: move to the deprecation dumpster

* chore: color coding class

* fix: only check import error when import errors
2024-10-08 18:56:10 +02:00
David
0aa652a565
fix: back compat 2024-06-24 10:16:51 +02:00
David
153d7cb7a3
feat: support reraising with error cause 2024-06-01 14:57:07 +02:00
Akhil Narang
45ffcf606e
Merge pull request #26462 from akhilnarang/tar-ignore-file-changed-as-we-read-it
feat: ignore `tar: file changed as we read it` during backups
2024-05-21 11:46:05 +05:30
Ankush Menat
025727674f
fix: scheduled type syncing (#26490)
- Scheduled Job sync when type was changed from scheduled to some other
  type didn't work.
- It updates on every save with message, bad DX IMO (can't save script
  and edit without dismissing)
- This was because of complex walrus which was triggering rest of code
  even when nothing changed. Maybe walrus opponents were onto something.
- `Truthy` couples two different operations and hence makes code
  complicated. In most cases where these checks are required it's not
  performance critical, we can do 1 more function call to avoid this
  coupling of change + actual value.
2024-05-20 13:43:20 +00:00
Akhil Narang
e3e6834b5d
fix: add errors=replace to decode() call
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-05-17 15:03:32 +05:30
Akhil Narang
803b45b9fa
feat: ignore tar: file changed as we read it during backups
This seems to occur when new files are being created as we're archiving
the files on a site. Doesn't make sense to fail the entire backup
because of that.

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-05-17 11:39:41 +05:30
gavin
665a18b063
fix: Implement Truthy.__eq __
Implement equality check, compare with True rather than self for a Truthy instance

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2024-05-13 14:17:40 +02:00
Gavin D'souza
36c80b77a4
fix: Set value default True for Truthy cls 2024-05-07 17:43:19 +02:00
Gavin D'souza
ffbf7fb9d1
fix!: Document.has_value_changed returns Truthy or False
- Return changed value to avoid re-accessing previous object & it's
   attribute
 - Wrap returned value as Truthy to avoid breaking change in API
2024-05-07 17:29:48 +02:00
Ankush Menat
d40b2a2517 fix(UX): help links and relative URLs
also closes https://github.com/frappe/frappe/issues/23020
2024-04-22 12:10:28 +05:30
Akhil Narang
1847e9cae8
fix: pass function as lambda
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-29 12:00:25 +05:30
Suraj Shetty
ec4261bd77 fix: Do not check for email validation on empty string 2024-03-02 21:20:51 +05:30
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
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
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
Hussain Nagaria
4d20ef9200 docs: get_gravatar and get_gravatar_url 2023-12-19 12:08:50 +05:30
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Ankush Menat
1e20820846
refactor: Indicate that weak hash functions are not usedforsecurity (#23540)
[skip ci]
2023-12-01 16:04:37 +05:30
David Arnold
9228cd70f8
fix: code style 2023-11-17 09:30:53 +01:00
David Arnold
5b33608fe3
fix: shell escaping in execute_in_shell helper 2023-11-16 10:52:11 +01:00
Ankush Menat
c69b043527
fix: send correct username in userinfo (#23177) 2023-11-11 08:08:39 +00:00
Akhil Narang
1119919971
refactor: use gzip library's compress() and decompress() methods directly
The util methods were added for python2.7 compat, mark them as deprecated

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-10-20 21:17:35 +05:30
Sambasiva Suda
7165f94148
fix: validate_email_addr should return email id as it is if it is valid (#22613) 2023-10-11 12:37:48 +05:30
Ankush Menat
e9a6c4ab13 fix: user info error when name case mismatches 2023-09-23 15:26:31 +05:30
Ankush Menat
d20e436e0f perf: fetch user info in one query 2023-09-18 11:16:20 +05:30
Ankush Menat
970a740164
revert: #22308 (#22389)
* Revert "chore: move function to correct file"

This reverts commit ebfdfa283b.

* Revert "refactor!: merge get_site_url into get_url (#22308)"

This reverts commit 2001bc278f.
2023-09-13 14:34:52 +05:30
Ankush Menat
ebfdfa283b chore: move function to correct file 2023-09-11 19:02:34 +05:30
David Arnold
2001bc278f
refactor!: merge get_site_url into get_url (#22308)
* chore: merge get_site_url into get_url

* fix: keep alias with deprecation notice
2023-09-11 15:09:05 +05:30
David Arnold
011e44656b
fix(test): ensure tests construe the site url from its constructor (#21870) 2023-09-02 15:36:24 +05:30
Ankush Menat
961585f1d9
fix: misc dx improvemnts (#22188)
* fix(dx): simplify adding callbacks

frappe.db.after_commit(func) == frappe.db.after_commit.add(func)

* fix: trace id missing

DB gets initted before request
2023-08-28 07:01:25 +00:00
Sagar Vora
7dc67f2feb chore: add back getattr for virtual docfields which get value from a property 2023-08-18 21:51:56 +05:30
Ankush Menat
a1f3114305
fix: sanitize frappe._dicts too in TB sanitizer (#22012) 2023-08-11 12:25:40 +05:30
barredterra
88c8baa9ee refactor: for append to extend, merge list extend
Replace a for append loop with list extend.
Create the list with values instead of creating
an empty list and extending it with another list.
2023-08-09 13:25:39 +02:00
barredterra
b553ed98d8 refactor: inline immediately returned variable
Inline a variable to a return in the case when the
variable being declared is immediately returned
2023-08-08 18:09:49 +02:00
David Arnold
3471685eaa
feat(ops): add environment variable to set bench root / workdir (#21872) 2023-07-31 11:50:09 +05:30
Ankush Menat
79532ea0f2 fix: incorrect cache clearing of assets
- Build version wasn't correctly computed since v14 update of build
  system. This makes client side cache useless.
- We clear cache assuming rapid reloads,but opening new tab also does
  that. This makes the cache effectively useless for most users.
2023-07-15 21:59:04 +05:30
Ankush Menat
adf30693a9 ci: update pyupgrade 2023-07-14 14:24:08 +05:30
Ankush Menat
8a37d6d278
perf: reduce memory usage of background processes (#21467)
* perf: defer translation.py imports

This indirectly imports babel which isn't really required most of the
time.

* perf: defer gzip import

* perf: move validate_and_sanitize_search_inputs

This causes all sorts of indirect imports and increases memory usage

* perf: defer requests module imports

* perf: defer system settings import

* perf: defer LOG_DOCTYPES import

Causes many indirect imports

* perf: defer update_site_config

* perf: defer notifications import

* perf: remove unused import

* perf: defer safe exec import

* test: memory usage overhead
2023-06-23 12:51:45 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Ankush Menat
6ce7444669 refactor: generic callback manager 2023-06-03 18:44:19 +05:30
Sabu Siyad
a1aaed0a5f
feat(util): get_table_name: wrap in backticks (#20553) 2023-04-03 11:26:49 +05:30
Ankush Menat
cd4d601ed4 fix: traceback sanitizer got extra positional args 2023-02-15 17:51:21 +05:30
Ankush Menat
338ccc5a2a
fix: sanitize form dict in error logs (#19835)
[skip ci]
2023-01-30 15:22:21 +05:30
Ankush Menat
70ee9272b1
fix: sanitize traceback for common secrets (#19805) 2023-01-27 12:44:33 +05:30
Gavin D'souza
d357af1533 refactor: Add a maxsplit limit to string splits 2023-01-24 19:22:51 +05:30