Commit graph

1737 commits

Author SHA1 Message Date
Ankush Menat
eb77ddab69 feat: Lazy loaded documents
https://docs.python.org/3/howto/descriptor.html#invocation-from-an-instance

After first invokation, object's __dict__ will be used... then we can
assume rest of the code works as expected (?)
2025-06-11 09:55:01 +05:30
Ankush Menat
12ab20f705 fix: Change local variable name
Shouldn't be same as function name
2025-06-10 23:52:27 +05:30
RitvikSardana
c193aad863
feat: add custom headers to any email in frappe.sendmail (#32820)
* feat: add custom headers to any email in frappe.sendmail

* fix: add headers only when it is provided

* fix: prepend headers with 'X='
2025-06-10 12:38:02 +05:30
Ankush Menat
f9ff807e4c
refactor: Rename get_settings -> get_single_value (#32840)
Not all single doctypes are settings, so this is better. Implicit
caching is fine, same is done for `db` APIs on singles. We *should* aim
for 100% correctness of caching implementation, especially for singles.

Thanks to @netchampfaris for the suggestion.
2025-06-09 04:20:29 +00:00
Ankush Menat
caf415f13e
feat: get_settings (#32821)
* feat: get_settings

get_cached_value doesn't work well with singles because you either need
to pass `None` or repeat doctype name... both are awekward and easy to
shoot yourself in foot with.

* refactor: Use cached settings
2025-06-06 18:34:17 +05:30
Ankush Menat
f1a03200ab fix: clear db.value_cache when clearing doctype cache 2025-06-05 14:46:03 +05:30
rohitwaghchaure
5c6b2b5bec
refactor: track completed app setup wizards and re-run the setup wizard upon new app installation. (#32640) 2025-06-03 12:36:22 +05:30
sokumon
28947b33dd fix: add informative guest message 2025-05-05 16:45:50 +05:30
Ankush Menat
360d19741e fix(recorder): patch replica DB connection 2025-04-24 11:02:03 +05:30
Akhil Narang
294013955e
chore: linting
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:17 +05:30
Akhil Narang
ad32216040
fix: support sqlite
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:16 +05:30
Akhil Narang
0b5e245507
feat: init sqlite
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:16 +05:30
jll-02
89ed7c90a7
feat: addes x-priority option to email header and the frappe.sendmail function (#31966)
creating the option to give the email an importance.
1 = Highest, 3 = Normal, 5 = Lowest
commonly used to flag the importance of emails

Co-authored-by: Jan Lukas Liesen <=>
2025-04-11 16:18:19 +05:30
rohitwaghchaure
d69a364e10
fix: item code not showing in the error message (#32028) 2025-04-08 14:20:35 +00:00
Sagar Vora
bd844579d2 refactor: trim frappe.__init__ 2025-04-06 10:30:23 +05:30
Sagar Vora
d82a1a443c perf: reduce attribute access in setup_module_map 2025-03-20 08:28:33 +05:30
Sagar Vora
f51f175ad2 chore: remove invalid type hint 2025-03-20 08:27:29 +05:30
Sagar Vora
41a8b708d1 perf(DX): store hooks in site cache 2025-03-20 07:43:08 +05:30
Sagar Vora
15d753ea52
Merge pull request #31811 from sagarvora/cache-params-directly
perf: cache signature params instead of signature
2025-03-20 01:06:25 +05:30
Sagar Vora
6435a77e41 perf: cache signature params instead of signature 2025-03-20 00:55:52 +05:30
Raffael Meyer
9430e3af86
fix: respect override_whitelisted_method in map_docs (#31718)
* refactor: override_whitelisted_method

* fix: respect `override_whitelisted_method` in `map_docs`

* refactor: override_whitelisted_method
2025-03-17 14:27:12 +01:00
Sagar Vora
b2cab51849
feat: re-introduce mysqlclient 🚀 (#31719)
* feat: mysqlclient

* fix: update error attrs

* fix: decode mogrified query to unicode

* fix: do some cleanup

* chore: disable cleanup for now

* fix: remove unnecessary call to as_unicode

* test: skip perf test for now

* fix: fallback to empty str

* fix: unbuffered cursor support

* fix: update converters and other changes

* fix: add cleanup back

* perf: improve timedelta converter

* fix: dont attempt to run query when explain flag is set

* test: cleanup tests

* chore: remove commented code

* perf: store conf as local var

* chore: ensure sequence

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2025-03-15 09:48:21 +05:30
Sagar Vora
042372ea86 perf: remove __getattr__ from local & localproxy 2025-03-13 22:36:31 +05:30
Sagar Vora
ad33435b33
Merge pull request #31660 from sagarvora/frappelocal
perf: faster local attr lookup
2025-03-12 14:13:46 +05:30
Sagar Vora
26bbb5985e
perf: use client_cache for print_sql (#31663)
* perf: use `client_cache` for `print_sql`

* chore: revert change to conn error handling code

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2025-03-12 08:43:09 +00:00
Sagar Vora
3c8912f6e7 perf: faster local attr lookup 2025-03-12 14:03:36 +05:30
Sagar Vora
20220ef894
fix: avoid one time setup (#31650) 2025-03-12 12:44:19 +05:30
Ankush Menat
6946e3353f refactor: split messages.py from init.py 2025-03-10 21:02:13 +05:30
Ankush Menat
ae4e2ede1a refactor: move init.py utils to utils/* 2025-03-10 21:01:14 +05:30
Maharshi Patel
15b025f03b chore: move get_print to print_utils.py
paying my share of taxes #28940
2025-03-08 11:40:31 +05:30
Maharshi Patel
c8b40b1805 Merge branch 'develop' into add_pdf_backend_hook 2025-02-28 10:15:32 +05:30
Sagar Vora
6e20eed640 fix: redo some fixes to ensure cypress passes 2025-02-20 12:51:37 +05:30
Maharshi Patel
11bac014f2 Merge branch 'develop' into add_pdf_backend_hook 2025-02-19 14:21:01 +05:30
Sagar Vora
f4062b4d7a fix: ensure consistent error in response 2025-02-19 12:10:59 +05:30
Maharshi Patel
463d1f2b05 fix: code changes as pdf_generator is now select field 2025-02-14 17:04:13 +05:30
Maharshi Patel
fc213ed761 fix: check for chrome_pdf_generator in form_dict first.
first check if chrome_pdf_generator is available in form_dict.
if not available which can happen if function is called from other places then set value from args or print_format.
2025-02-14 11:04:24 +05:30
Maharshi Patel
61aabd00af chore: renamed arg name and cleanup
- fixed chrome_pdf_backend arg by making it int and using it to properly override which pdf generator (chrome / wkhtmltopdf) to use.
- renamed new_pdf_backend to chrome_pdf_backend.
- added chrome_pdf_backend arg in local.from_dict to avoid passing it 4-5 functions deep
2025-02-12 13:24:50 +05:30
Maharshi Patel
cf0fe8eecd fix: read_file return base64 encoded string
- added flag to read_file to return base64 encoded string
- fixed pdf_header_footer_chrome to remove unused subst function call
- added new_pdf_backend flag to get_print_format_template function
2025-02-04 20:36:44 +05:30
Maharshi Patel
3caa2414e0 chore: Merge branch 'develop' into add_pdf_backend_hook 2025-02-01 19:58:11 +05:30
Maharshi Patel
dd037f54ea feat(minor): add pdf backend hook
added new_pdf_backend hook to run alternate get_pdf function from other apps e.g. print designer.
2025-02-01 19:47:29 +05:30
Ankush Menat
f30159adc6 feat: custom response header support 2025-01-24 18:35:26 +05:30
Ankush Menat
e4a2b8db38
refactor: trim init.py (#29866)
* refactor: Trim `__init__.py`

We strayed from the goal here: https://github.com/frappe/frappe/pull/29181

So making up for it.

* chore!: Delete unused get_version

Not used anywhere

* refactor: move few more functions to relevant place

* asd
2025-01-20 13:05:02 +00:00
Sagar Vora
e7073a5f28
perf: faster LocalProxy (#29181)
* perf: faster `LocalProxy`

* refactor: use callable style local

* test: add some tests for local proxy override

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2025-01-20 12:49:55 +00:00
Ankush Menat
cc838022b1 perf: use client cache for fetching website settings and theme 2025-01-14 14:40:25 +05:30
Ankush Menat
374bba5979 perf: use client cache for metadata version 2025-01-14 13:28:42 +05:30
Ankush Menat
fdba41c682
perf: misc client cache improvements (#29070)
* perf: Reduce penalty for lack of redis connection

If redis isn't running than this client cache is slower than default
implementation because of the extra locking overhead.

* test: update perf redis counts

* perf: cache table columns in client-cache

* fix: race condition on cache-client_cache init

Rare but apparant in synthetic benchmarks.

Cache is set but client cache is still being initialized then request
will fail.

* perf: Don't run notifications when loading document

WHAT?

* fix: use cached doc to repopulate

* perf: reduce get_meta calls
2025-01-07 16:14:43 +05:30
Ankush Menat
73dc99275d refactor: move get_system_settings
- This should not be in init.py
- set_single_value is not a good alternate for properly cleaning up cache.
2025-01-06 20:31:38 +05:30
Ankush Menat
b7ddd1df92 perf: cache hooks in client-side cache 2025-01-06 20:24:27 +05:30
Ankush Menat
b60a1292bd perf: store app-module mappings in client cache 2025-01-06 19:46:42 +05:30
Ankush Menat
7ea0421624 perf: cache system settings in client side cache 2025-01-06 19:40:07 +05:30