Commit graph

1450 commits

Author SHA1 Message Date
gavin
a14b38cc4e
Merge branch 'develop' into modules-refactor 2022-08-09 16:10:36 +05:30
Sagar Vora
c82b6e758e
Merge pull request #17681 from resilient-tech/fix-child-perm
refactor: improved child table permission check
2022-08-09 10:15:36 +00:00
Sagar Vora
7129d6128f chore: lazier import; improved docstrings 2022-08-09 11:50:15 +05:30
Gavin D'souza
624c308659 Merge branch 'develop' of github.com:frappe/frappe into modules-refactor 2022-08-08 12:27:11 +05:30
Sagar Vora
eb1c9fff68 fix: translate each role 2022-08-02 19:28:33 +05:30
Sagar Vora
74c26ac34d fix: use throw 2022-08-02 19:16:53 +05:30
Sagar Vora
61ec026712 refactor: improve frappe.only_for 2022-08-01 22:10:25 +00:00
Sagar Vora
d6aa17cc14 chore: add deprecation warning everywhere verbose is used 2022-07-31 00:24:21 +05:30
gavin
f40214bca8
fix(get_last_doc): Allow for_update as kwarg only
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2022-07-22 13:34:04 +05:30
Gavin D'souza
006ebcbede refactor: Use pymysql over mariadb client
This is supposed to be a temporary switch to make the parent PR easier
to digest. MariaDB client has some issues with release, and system
dependencies.

This commit may be reverted to enable mariadb client again.
2022-07-22 12:10:54 +05:30
Gavin D'souza
1ccdad811a Merge branch 'develop' of github.com:frappe/frappe into mariadb-client-refactor 2022-07-19 16:23:24 +05:30
Shariq Ansari
a50e0ffa08
refactor: Webform (#17232) 2022-07-19 15:52:15 +05:30
Ankush Menat
0164a87ac9
Merge pull request #17350 from Aradhya-Tripathi/get-all-mod
feat: Adding support to Query engine
2022-07-13 18:36:04 +05:30
Gavin D'souza
71b5c77e6e Merge branch 'develop' of github.com:frappe/frappe into mariadb-client-refactor 2022-07-05 14:55:02 +05:30
mergify[bot]
fa3f72fef4
Merge pull request #17289 from surajshetty3416/cleanup-libs
chore: Remove unused libraries/files and update licenses
2022-07-05 05:17:14 +00:00
Ankush Menat
9a5d11234c
fix: validate scheduler, hook method names (#17400)
* chore: warn about missing scheduler / doc events

* fix: pass list instead of filter

filter can only be iterated upon once

* refactor: many typehints in __init__.py
2022-07-04 19:29:16 +05:30
Suraj Shetty
81436dc688 fix: Remove unused function and listener 2022-07-04 14:59:26 +05:30
Aradhya Tripathi
ebd1d5b48c
Merge branch 'develop' into get-all-mod 2022-07-01 13:25:32 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Gavin D'souza
fddd624a7c Merge branch 'develop' of github.com:frappe/frappe into mariadb-client-refactor 2022-06-30 14:31:52 +05:30
Ankush Menat
813dcc1848
Revert "feat: Adding support to Query engine" 2022-06-29 23:30:23 +05:30
Gavin D'souza
cf699fe40b Merge branch 'develop' of github.com:frappe/frappe into mariadb-client-refactor 2022-06-29 13:49:18 +05:30
gavin
91e76ff874
Merge branch 'develop' into get-all-mod 2022-06-28 19:47:20 +05:30
Aradhya
7732accded feat: Attached Engine object to qb & added dynamic type hints 2022-06-28 19:43:23 +05:30
gavin
3ddac3ba58
Merge branch 'develop' into mariadb-client-refactor 2022-06-28 18:09:49 +05:30
gavin
bb0283a1cf
Merge branch 'develop' into mariadb-client-refactor 2022-06-28 14:57:21 +05:30
Gavin D'souza
07d7b34fd9 refactor: get_unsubscribe_message
* Add fallback label "Unsubscribe" instead of printing None in the email
* Add typing hints, f-stringify & make code DRY-er for better readability
2022-06-28 12:08:00 +05:30
Ankush Menat
112f113598
fix!: remove dangerous "rollback_on_exception" flag (#17321) 2022-06-27 17:04:34 +05:30
Gavin D'souza
ef078a4ab5 refactor(db-read_only): Track conn type in Database instance 2022-06-23 19:40:17 +05:30
gavin
574f160d3c
Merge branch 'develop' into mariadb-client-refactor 2022-06-23 16:13:03 +05:30
Deepesh Garg
26d0e7a0f9
fix: App logo not set in website settings (#17261)
* fix: App logo not set in website settings

* chore: potential error in system settings
2022-06-21 20:07:59 +05:30
gavin
73f6141e0d
Merge branch 'develop' into mariadb-client-refactor 2022-06-20 15:31:53 +05:30
Gavin D'souza
14003e5ac9 refactor: DISABLE_DATABASE_CONNECTION_POOLING conf + var name 2022-06-20 15:31:15 +05:30
Raffael Meyer
7b67e1f847
fix: translate doctype in error messages (#17239) 2022-06-20 10:35:57 +05:30
Gavin D'souza
b4578dc632 Merge branch 'develop' of github.com:frappe/frappe into mariadb-client-refactor 2022-06-15 16:40:29 +05:30
Gavin D'souza
36fa2122a3 fix: Patch qb for different schemas in same process
You would want to switch schemas in the same process. Eversince the
change
64e5273764
we stopped patching on every frappe.init call which meant, if a MariaDB
site was initialized first, frappe._qb_patched would be set to True and
if a Postgres site was initialized after, _qb_patched would be lying as
the PG engine isn't patched yet. Sooooo we need a Dict instead to
maintain this record of patching. This issue caused weird errors lol -

Traceback:

  File "/home/frappe/Desktop/frappe-bench-dev/env/lib/python3.10/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/commands/site.py", line 524, in migrate
    SiteMigration(
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/migrate.py", line 169, in run
    self.setUp()
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/migrate.py", line 73, in setUp
    clear_global_cache()
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/cache_manager.py", line 102, in clear_global_cache
    clear_website_cache()
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/website/utils.py", line 374, in clear_website_cache
    clear_cache(path)
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/website/utils.py", line 369, in clear_cache
    for method in frappe.get_hooks("website_clear_cache"):
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/__init__.py", line 1440, in get_hooks
    hooks = _dict(_load_app_hooks())
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/utils/caching.py", line 57, in wrapper
    return_val = func(*args, **kwargs)
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/__init__.py", line 1407, in _load_app_hooks
    apps = [app_name] if app_name else get_installed_apps(sort=True)
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/utils/caching.py", line 57, in wrapper
    return_val = func(*args, **kwargs)
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/__init__.py", line 1374, in get_installed_apps
    installed = json.loads(db.get_global("installed_apps") or "[]")
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/database/database.py", line 917, in get_global
    return self.get_default(key, user)
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/database/database.py", line 921, in get_default
    d = self.get_defaults(key, parent)
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/database/database.py", line 938, in get_defaults
    defaults = frappe.defaults.get_defaults(parent)
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/defaults.py", line 88, in get_defaults
    globald = get_defaults_for()
  File "/home/frappe/Desktop/frappe-bench-dev/apps/frappe/frappe/defaults.py", line 218, in get_defaults_for
    frappe.qb.from_(table)
TypeError: 'Field' object is not callable
2022-06-15 15:55:43 +05:30
Ankush Menat
ea416f9d6b feat: log settings with "interface"
We have hardcoded "Log settings" to only apply on 3 doctypes, there are
few more logging doctypes in core which are not cleared right now, on
top of that it's not easy for user to configure all logging behaviour
from one place.

This change adds a table on log settings where logging doctypes that
support the interface required by log settings can auto-register and
show up in settings.

Currently only supported configuration is "number of days" to keep.
2022-06-15 12:30:38 +05:30
Gavin D'souza
80b19a6031 fix: Cast singles_dict' values
This is to adapt with the changes made in frappe.db.get_singles_dict in
the previous commit
2022-06-15 10:40:26 +05:30
Gavin D'souza
678eebe4fb perf: Limit re internal cache to avoid caching patterns twice 2022-06-14 17:16:34 +05:30
Gavin D'souza
e681233e98 perf: Fetch and cache entire settings' dicts 2022-06-13 18:39:56 +05:30
Gavin D'souza
64e5273764 perf: Patch qb only once - not on every init 2022-06-13 18:39:56 +05:30
Gavin D'souza
54dd72b8da chore: Import sys in msgprint's namespace 2022-06-09 12:43:56 +05:30
gavin
9ce74fb6c4
Merge branch 'develop' into request-cache 2022-06-09 12:32:03 +05:30
Sagar Vora
df28f32b8b
perf: ~90% faster frappe.get_cached_doc (#17107) 2022-06-08 15:49:11 +05:30
gavin
44dba28159
Merge branch 'develop' into refactor-file 2022-06-08 12:43:35 +05:30
Gavin D'souza
9f2d3bf33e fix: Clear site_cache, request_cache on clear_cache 2022-06-07 18:17:44 +05:30
Gavin D'souza
39fe348ee9 perf: frappe.get_hooks
From 115 µs ± 2.31 µs to 2.69 µs ± 27 ns per call

Changes:
* Use request_cache over get_installed_apps, _load_app_hooks
* Refactor logic for default - so that None is an acceptable value
* Remove handling of webnotes app in get_hooks - 8yo code ^_^
2022-06-07 18:09:57 +05:30
Ankush Menat
111df3a8d7 perf: improve document caching
As per current implementation whenever `get_doc` is called, document is
cached. However, this cache is only ever used by `get_cached_doc`. Going
through the codebase of both FF/ERPNext you'll find that `get_doc` is
used a lot more than `get_cached_doc`. So in many places, all this
caching overhead is unnecessary.

This change removes implicit caching from get_doc and replaces it with
cache-replacement instead. i.e. cache is only updated if it exists but
not created from get_doc.

Pros:
- faster `get_doc`
- lower memory usage on Redis
- Reduces chances of OOM by blowing up worker's memory as old docs can't
  be GCed until
- Correctness i.e. caching only what gets used from cache.

Con:
- After this change. First call to `get_cached_doc` will always be a cache miss. DUH.
2022-06-06 16:18:23 +05:30
Gavin D'souza
5ec2690160 Merge branch 'develop' into refactor-file 2022-06-01 15:47:55 +05:30
Ankush Menat
f8f29e284f
perf: store compact JSON in version diffs (#17042) 2022-05-31 22:40:07 +05:30