Commit graph

1496 commits

Author SHA1 Message Date
Ankush Menat
3f1deeba67
fix: can't sign out due to missing roles (#19905) 2023-02-02 22:53:24 +05:30
Ritwik Puri
fb9ae0823e
Merge pull request #19716 from resilient-tech/simpler-doc-cache
chore!: remove special local cache for documents (and related `cache_locally` parameter)
2023-01-25 22:21:12 +05:30
Gavin D'souza
d357af1533 refactor: Add a maxsplit limit to string splits 2023-01-24 19:22:51 +05:30
Sagar Vora
23c9d8a42d chore: remove old cache reference 2023-01-21 17:46:41 +05:30
Sagar Vora
30941c49f5 chore!: remove special local cache for documents 2023-01-21 17:28:42 +05:30
Ankush Menat
0449f851c7
fix: correct exit code on missing app failure (#19676) 2023-01-20 13:51:00 +05:30
Richard Case
e80c8ac862
fix: improved installed app fail feedback (#19668) 2023-01-20 13:02:09 +05:30
Ankush Menat
fa55793a52
Merge pull request #19405 from netchampfaris/refactor-qb-engine
refactor: qb.engine
2023-01-18 21:17:17 +05:30
Ankush Menat
4bb5b10c7f
fix(DX): better error msg for non-whitelisted methods (#19616)
[skip ci]
2023-01-17 12:06:39 +05:30
Ankush Menat
5e2bbf834f refactor: filter out apps not installed on bench 2023-01-16 13:54:40 +05:30
Sagar Vora
f5cbcec103 fix: defer local.all_apps loading 2023-01-16 13:54:27 +05:30
Sagar Vora
d8b7bc18d7 refactor!: deprecate sorting based on apps.txt in get_installed_apps 2023-01-16 13:54:27 +05:30
jiangying
0898ac2a0e
docs: fix docstring for get_list filters (#19569)
* chore: fix doc in frappe/__init__.py

should be filter as a list of dicts

* Update __init__.py

* doc: remove `filter as a list of dicts`
2023-01-11 17:16:19 +05:30
Faris Ansari
be654eaa60
Merge branch 'develop' into refactor-qb-engine 2023-01-09 15:23:20 +05:30
Alfredo Altamirano
d0f880e5c5
fix: Improve JSON export format readability (#19429)
* Improve JSON export format readability

* fix: Enable ensure_ascii flag on export_json

* style: fmt

[skip ci]

Co-authored-by: Alfredo Altamirano <Ahuahuachi@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-01-04 12:33:45 +05:30
Faris Ansari
726fcfdb79 refactor: qb.engine
- simplify
- qb.engine.get_query -> qb.get_query
- qb.engine.build_conditions -> qb.get_query
2022-12-25 23:19:11 +05:30
barredterra
ab95cffae9 fix: re-introduce html param for attach_print
Fix error introced by d64836c1c4
2022-12-19 14:26:15 +01:00
Gavin D'souza
d66eed129c refactor: validate_argument_types
* Rename API for ease of public use
* Add validation condition parameter
* Move function to utils module instead of frappe namespace
2022-12-19 15:07:03 +05:30
Gavin D'souza
4fe260e09e refactor: transform_parameter_types
- Switch to Pydantic which is under continuous development and can
  support more types
- Equivalent Pydantic API will try to transform data if possible
- The previous point makes it such that we don't need to explicitly try
  to parse each stringified int in app code since Pydantic can do this
- Drop typeguard since it did not handle 3.10+ native typing definitions
2022-12-15 13:47:05 +05:30
Gavin D'souza
d78b967f8d test: Run type validation checks in test mode for whitelisted APIs 2022-12-15 13:47:05 +05:30
Gavin D'souza
3fd74afa47 feat(whitelisted): Runtime typing hints validation
- Run type validations if annotations exist for whitelisted functions
- Run validations only on function calls in presense of frappe.local.request

In action:

```bash
> curl -H 'Content-Type: application/json' 'http://photos:8000/api/method/frappe.handler.download_file' -d '{"file_url": ["!=", "gavin.jpg"]}'
```

Note: This ignores stringified or ForwardRef types. If you want types to
be validated make sure they are not imported under `if TYPE_CHECKING`
blocks
2022-12-15 13:47:05 +05:30
Gavin D'souza
ccbc833c6c feat: runtime check via pydantic
handle localns stringified types
2022-12-15 13:47:05 +05:30
barredterra
22ea39a442 fix: remove unused html parameter
from `attach_print`and `get_print`
2022-12-14 14:37:56 +01:00
Ankush Menat
170b7c9b0f chore: correct devel version 2022-12-13 14:20:55 +05:30
Alfredo Altamirano
ffe3ba140e
fix: TypeError when using frappe.throw() or frappe.msgprint() with lists (#19255)
Co-authored-by: Alfredo Altamirano <Ahuahuachi@users.noreply.github.com>

[skip ci]
2022-12-13 11:59:58 +05:30
Raffael Meyer
bb5b0e5e64
refactor!: remove compare util from frappe package (#19234)
Use `from frappe.utils import compare` instead of `frappe.compare`.
2022-12-11 23:20:21 +05:30
Ankush Menat
49437f53b4
feat: operation level locking for CLI commands (#19162)
This prevents mistakenly issuing same commands twice which can be
dangerous.

added global lock(s):
- [x] bench build

added site level lock(s):
- [x] bench new-site sitename
- [x] bench --site sitename migrate
- [x] bench install-app appname
- [x] bench build
- [x] bench restore (the code is just meh, needs some cleanup)

closes https://github.com/frappe/frappe/issues/13215
2022-12-08 13:24:43 +05:30
Raffael Meyer
73f0256aa8
feat: add param letterhead to frappe.get_print (#18989)
* feat: add param letterhead to frappe.get_print
2022-11-24 13:15:24 +05:30
Ankush Menat
c658d8cb1b
fix: ignore unpicklable hooks (#18902)
If any custom app use import statement in hooks.py everything breaks.
Hooks.py while being python file is still only supposed to be used for
configuring.

This PR ignores unpicklable members of hooks.py
2022-11-17 11:50:18 +05:30
Ankush Menat
f34f7030a3 refactor: remove txt param from generate_hash use 2022-11-10 11:56:48 +05:30
Ankush Menat
fcaa16bb21 perf: faster generate_hash 2022-11-10 11:36:40 +05:30
Sagar Vora
764370f3c6
fix: set proper cache key for singles when name is passed as None (#18667)
[skip ci]
2022-10-29 17:34:52 +05:30
Ankush Menat
3ddac5fe92
refactor: accurate translation caching (#18595)
* refactor: rename poorly named functions

* refactor: getting translation from apps

- use generator
- use sane name for cache key
- avoid manual handling of frappe.local state just use cache() interface
2022-10-27 16:28:02 +05:30
Ankush Menat
35ba00a54e
fix: handle isatty correctly (#18277)
sys.stdin can be `None`

[skip ci]
2022-10-03 12:05:55 +05:30
Sagar Vora
d947f9c37a fix: set brackets - walrus doesnt get priority 2022-09-19 17:01:40 +05:30
Sagar Vora
c216cd1500 chore: semantic changes to document caching code
[skip-ci]
2022-09-19 16:53:47 +05:30
Ankush Menat
bcb5fe91aa fix: pickle doc objects directly
This seems to be missed out and causes performance regression in IRL
usage when get_doc is called on cached doc already.
2022-09-19 16:21:20 +05:30
Ankush Menat
abd018773b refactor: drop _allow_dict support
This is not required anymore since we store full doc anyway. Also since
they share same cache key calling get_cached_value and get_cached_doc
can end up doing duplicate / double work.
2022-09-19 16:21:11 +05:30
Sagar Vora
6c6a969d3a perf: simpler, faster meta cache 2022-09-19 16:21:11 +05:30
Ankush Menat
ea7fbb2c10 refactor: remove dead flag db.read_only
This was added in last DB refactor but it does nothing, it was probably
supposed to do something with the connection pool but to best of my
knowledge "read only" is not a property of a connection.

It can be achieved with users who only have read access, that however
isn't implemented anywhere.

Removing this for now.
2022-09-09 17:34:46 +05:30
Ankush Menat
55617b9e86 fix: defer logging during read only mode
Deferred:
- Error log
- view log
- web page view

Disable:
- "_seen" tracking used on list view to highlight unseen docs.
- "seen" on error log.
- dashboard chart last ts caching
2022-09-09 17:34:46 +05:30
Ankush Menat
5beccd8802 feat: allow reads during maintenance_mode
To reduce downtime reading from main db server during maintenance_mode
can be allowed. This lets users browse desk, static sites or any other
pages while ensuring that no writes happen to DB.

refactor: use read replica if available
2022-09-08 18:22:03 +05:30
Ankush Menat
7b3cc322f1
Merge pull request #17891 from ankush/misc_fixes
perf: ~45% faster Desk first response
2022-08-22 11:45:20 +05:30
Ankush Menat
2eec621e95 chore: db.get_all -> get_all
Reduces 1 pointless function call.
Function calls are also not "super cheap" in python.
2022-08-22 11:35:14 +05:30
Ankush Menat
4241f8c8c0 perf: simpler/faster preload header computation
We parse entire response to find preload headers, instead just use
include_style and include_script to include assets directly into preload
headers. This shaves off ~13% overhead in response.
2022-08-21 18:46:58 +05:30
Ankush Menat
d61705f528 perf: use cached docs for system settings 2022-08-16 12:24:42 +05:30
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