Commit graph

1582 commits

Author SHA1 Message Date
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
Ankush Menat
5e2ace4c08
perf: Use set for tracking whitelisted methods (#23905)
List look ups are O(N). This is still a microoptimization at best
considering other overhead.
2023-12-21 23:19:06 +05:30
Hussain Nagaria
c70229cd69 docs: consistency 2023-12-19 12:55:41 +05:30
Hussain Nagaria
370d575f29 docs: some more utils 2023-12-18 22:27:58 +05:30
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Hussain Nagaria
75d81da634 fix: unicode handles more than just str 2023-12-17 16:35:29 +05:30
Hussain Nagaria
cf28fe2da4 fix: consistency 2023-12-17 00:29:48 +05:30
Hussain Nagaria
1a2d8fe78a docs: get_system_settings
* IMO this should be renamed to something like `get_from_system_settings`
2023-12-16 22:18:31 +05:30
Hussain Nagaria
0fa0d1ff0e docs: frappe.bold 2023-12-16 16:48:11 +05:30
Hussain Nagaria
d5ccb51251 docs: frappe.as_json 2023-12-16 14:25:39 +05:30
Ankush Menat
71e31a4200 chore: version bump 2023-12-01 10:36:49 +05:30
Ankush Menat
0e8b4de96f fix: tweak sentry config
- disable session tracking - This causes sentry to phone home on every load, we don't need this (yet)
- disable automatic integrtaions (like redis)
- disable all default integration and cherry-pick what's required
2023-11-30 19:01:19 +05:30
Akhil Narang
9a0a5468c5 feat: setup sentry integration
Inspired primarily from sentry's generic WSGI integration

Environment variable `FRAPPE_SENTRY_DSN` needs to be enabled as well
as explicit opt-in from the user's side in system sid telemetry
settings

Conditionally include telemetry JS bundles

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-30 17:13:41 +05:30
Ankush Menat
f01937c788
fix(DX): return email queue doc (#23495) 2023-11-29 17:34:42 +00:00
Ankush Menat
957293bd54 fix: Only preload icons for desk 2023-11-29 21:50:18 +05:30
Ankush Menat
a8a8f8d438
feat: msgprint using socketio (#23408) 2023-11-24 10:54:07 +00:00
Akhil Narang
fbc88a4d24
refactor(treewide): code cleanup
Drop redundant bool conversion

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-23 13:57:51 +05:30
Akhil Narang
eb45da3913
feat: Allow usage of print() within safe_exec() (#23084)
* feat(safe_exec): allow usage of `print()`

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* refactor(system_console): update description to mention `print()` instead of `log()`

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* feat: unconditionally add debug logs to response if present

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore(safe_exec): add in a test for running `print()` within safe_exec

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* fix(safe_exec): ignore warning

RestrictedPython warns us if we call `print()` don't use their `printed` variable

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* feat: store debug logs from scheduled jobs

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* fix: avoid ignoring warnings, disabled in prod anyway

* chore: remove unnecessary logging

This can be moved to level 2 when required

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-11-20 12:45:41 +05:30
Ankush Menat
089985e53b feat: frappe.job local for reading job info 2023-11-04 14:06:31 +05:30
Raffael Meyer
f0155674a5
refactor!: remove redundant sending of translations (#22962)
* chore!: remove redundant translation

* refactor!: remove "get_translated_dict" hook

Instead, include the results from
`frappe.geo.country_info.get_translated_dict` in `get_all_translations`.

* test: money_in_words uses translated currency

... and now we have translations.

* Revert "test: money_in_words uses translated currency"

This reverts commit e07d594ac1ce4b120c0fceb5d23377cb981fe820.

* refactor!: stop translating timezone and currency

* refactor: rename `get_translated_dict`

... to `get_translated_countries`
2023-11-02 20:04:14 +05:30
Ankush Menat
08b92858a3
fix: ignore duplicate perm check on assign hooks (#22832)
* fix: Ignore permissions while assigning if flag set

* fix: Avoid double permission checks on assignment rule

When it's triggered via doc events either:
- Permission check is done or
- Permission checks are not applicable
2023-10-20 06:18:19 +00:00
Corentin Flr
1a589d9354
fix: Fix get_message_log extra json.loads (#22827) 2023-10-19 23:32:09 +05:30
Sagar Vora
93a8c37977 fix: type hint for keyword-only parameter for_update
[skip ci]
2023-10-18 17:36:45 +05:30
Ankush Menat
e2714c3e1c feat: v2 error and debug log structure 2023-10-16 18:13:50 +05:30
Ankush Menat
018ed845bd refactor: defer unnecessary json-dumping of messages
Also avoid accessing locals where interface is present like for popping last message.
2023-10-16 18:13:50 +05:30
Ankush Menat
0a244b10fc test: basic tests v2 API 2023-10-16 18:12:53 +05:30
Ankush Menat
9983bf82e6 fix: backward compatible get_site_path
Before: `./sitename`
After:  `sitename`

This used to return `.` before, even though these are paths identical
they aren't REALLY. Tar command strips 2 subpaths so this ended up
breaking file restores.
2023-10-11 17:30:13 +05:30
Ankush Menat
a81fb2a11a
Merge pull request #22509 from netchampfaris/file-backup-path
fix: use relative path in file backup
2023-09-24 10:06:47 +05:30
Faris Ansari
fa88f1a628 fix: resolve path instead of absolute path
#22142 made the change to absolute path but it affected file backups.
Resolve path should probably be enough in most cases.
2023-09-23 11:05:49 +05:30
Ankush Menat
8cb13f922a chore(DX): Annotate all local proxies 2023-09-18 15:36:58 +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
niraj gautam
db61deef72
fix: Avoid doc caching if for_update is set (#22203)
* refactor: Avoid doc caching if for_update is set

* chore: simplify condition

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2023-08-25 19:35:32 +05:30
Ankush Menat
6e0b522ae3 refactor!: Disable server scripts by default
- Move the config to bench level and not site level because, server
  script "threat model" requires consent from a bench owner and not
  individual site.
- While this is a breaking change which people may not like, we believe
  it's essential to improve security model of Frappe.
2023-08-23 14:49:05 +05:30
mergify[bot]
fe820ae8c8
Merge pull request #22142 from barredterra/abs-pymodule-path
feat(DX): return absolute path
2023-08-23 05:40:38 +00:00
Ankush Menat
04a13ca97c
fix: frappe.clear_cache should drop all keys (#22156)
We are dropping some keys which are hardcoded in function.

- this over time might be out of sync with rest of the code.
- other apps cache stuff too.

Best fix: just clear everything.
2023-08-23 11:02:45 +05:30
Sagar Vora
29e5ad4fca fix: set correct document label in case doc is of type str 2023-08-22 15:24:26 +05:30
barredterra
158a6f8140 refactor: use get_app_path in get_module_list 2023-08-21 17:53:47 +02:00
barredterra
8971709655 feat: return absolute site path 2023-08-21 17:53:10 +02:00
barredterra
8cfee4dfe2 feat: return absolute pymodule path 2023-08-21 17:13:35 +02:00
Raffael Meyer
8f7a4f6697
Merge pull request #21873 from blaggacao/dont-exceed-python-module-boundary 2023-08-21 17:10:27 +02:00
Ankush Menat
3531f58b54 refactor: unify safe_exec and safe_eval code
A lot of duplication was present for this code.
2023-08-21 11:59:53 +05:30
barredterra
5944d387be Merge remote-tracking branch 'upstream/develop' into refactor-attach-print 2023-08-20 15:38:05 +02:00
David Arnold
8dabd2bae6
refactor: make the app source accessor explicit
The parent folder of a python module (inside `./site-packages`) can be
`./lib`. Separate code paths that depend on the app source into its own
getter so that patching that function becomes easier in those cases
where the python module is not served from the source checkout.
2023-08-20 01:11:05 +02:00
Ankush Menat
4d5a945861
refactor: reduce duplication in unsafe attr checks (#22033) 2023-08-13 18:23:41 +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
8d6480df1c Merge remote-tracking branch 'upstream/develop' into refactor-attach-print 2023-08-04 00:25:09 +02:00
barredterra
b1a2c31fe8 feat: letterhead param for attach_print 2023-07-27 18:29:22 +02:00
barredterra
44a3d9d69e refactor: attach_print
- Use print_language context manager
- Move filename and ignore_print_permissions closer to usage
2023-07-27 18:07:02 +02:00