Ritwik Puri
b78452dc00
Merge pull request #19472 from ankush/set_value_bad
...
refactor: deprecate usage of set_value with None as docname
2023-01-04 11:44:57 +05:30
Ankush Menat
e00023deb1
refactor: replace bad usage of db.set_value
2023-01-04 11:13:53 +05:30
gavin
804f0336e1
Merge branch 'develop' into typing-001
2023-01-03 14:29:33 +05:30
gavin
2571876d66
chore(oauth): Make provider typing optional in redirect_post_login
...
Co-authored-by: Ritwik Puri <ritwikpuri5678@gmail.com>
2023-01-03 14:28:56 +05:30
Gavin D'souza
d13c377848
refactor: OAuth
...
* Added typing hints for Oauth APIs and dependant utils
* Simplify oauth core flows
* Remove long commented code
* Use newer, simpler syntax for better readability
2022-12-27 19:25:43 +05:30
Gavin D'souza
ef82ef944e
fix: build_response for re.Match
2022-12-27 14:17:09 +05:30
Aditya Hase
6f8a087c5f
fix(subscription): Allow remote_login even if subscription.expiry is not set
...
remote_login is used for the "Subscribe" banner as well as the Manage Subscription button.
2022-12-26 14:18:58 +05:30
Bread Genie
9e79df9802
ci: use $GITHUB_OUTPUT instead of set-output ( #19389 )
...
* refactor(boilerplate): use `$GITHUB_OUTPUT` instead of `set-output`
* ci: use `$GITHUB_OUTPUT` instead of `set-output`
* fix: remove unterminated string literal
2022-12-22 14:16:09 +05:30
Bread Genie
211880d693
fix(boilerplate): add redis services in GHA ( #19376 )
...
* feat(boilerplate): add redis services
* chore: bump all action versions
[skip ci]
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2022-12-21 12:39:00 +05:30
Daizy Modi
d88ef967b9
feat: hook ignore_links_on_delete to skip doctypes on delete ( #19347 )
...
* feat: hook `ignore_links_on_delete` to skip doctypes on delete
* fix: helper comment
* fix: helper comment
* test: test case for `ignore_links_on_delete`
* test: fix test case
2022-12-20 11:17:28 +05:30
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
06cf18d0aa
chore: Add optional typing hints for params with default None
2022-12-15 13:47:05 +05:30
Gavin D'souza
d978ed7d06
refactor: Raise FrappeTypeError in case of type mismatches
2022-12-15 13:47:05 +05:30
Gavin D'souza
ec931004ca
refactor: transform_parameter_types
...
Failfast if args and kwargs or annotations don't exist
2022-12-15 13:47:05 +05:30
Gavin D'souza
579aa124e1
fix(type-check): Convert tuple types to Union
2022-12-15 13:47:05 +05:30
Gavin D'souza
299a017081
fix(type-check): Parse and validate arbitrary objects
2022-12-15 13:47:05 +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
73b0971a26
test: Add tests for typing validations
2022-12-15 13:47:05 +05:30
Gavin D'souza
41d6c791f1
fix: Build args dict correctly
2022-12-15 13:47:05 +05:30
Gavin D'souza
8e125f577e
fix(type-check): Allow some slack for bool to be int or float
2022-12-15 13:47:05 +05:30
Gavin D'souza
f3250808f0
fix: Use typeguard to handle base hints
...
Pre process exceptions that Frappe requires and pass the ruleset to
typeguard's check_type API
2022-12-15 13:47:05 +05:30
Gavin D'souza
d8cd1be23b
fix: Skip type checking if any allowed type is stringified
2022-12-15 13:47:05 +05:30
Gavin D'souza
d3250f6504
refactor(whitelisted): Add typing hints to APIs
...
* Refactor type checks defined in APIs
* Remove dead/deprecated kwargs usages
* Added appropriate hints to APIs and consecutive utils defined in the following modules:
- frappe.realtime
- frappe.translate
- frappe.utils.global_search
- frappe.www.third_party_apps
- frappe.www.search
- frappe.www.printview
2022-12-15 13:47:05 +05:30
Gavin D'souza
6678007a8d
fix: Support missing Optional or mismatching annotation types
...
Allow default types as acceptable values if not included in typing
hints. A common example of this is:
def test_password_strength(new_password: str, user_data: Sequence = None):
where Optional[Sequence] is implicit since default value is None.
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
barredterra
67ede5d533
feat: add parameters language and letter_head to download_pdf
2022-12-14 13:59:46 +01:00
Ankush Menat
d13ab320b7
refactor: Duplicate enqueue checks
...
scheduled_job_type.enqueue already does check for duplicate job and is
more "recent"
2022-12-14 15:46:46 +05:30
Ankush Menat
2b050f9fc3
test: test without adding hacky flags
2022-12-14 15:46:46 +05:30
Ankush Menat
82d699a801
refactor: misleading "log and raise" and types
2022-12-14 15:46:46 +05:30
Ankush Menat
290a3df68d
chore!: drop backup.py direct calls + pragma nocov
2022-12-13 14:18:19 +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
Ankush Menat
b11793ab02
fix: set filename explicitly for safe_exec
2022-12-07 16:34:27 +05:30
Sagar Vora
5f2cc8ec79
chore: keep previous order for easy backport
2022-12-07 14:09:02 +05:30
Sagar Vora
0c220169da
chore: reorder pylint disable
2022-12-07 13:50:59 +05:30
Sagar Vora
aa53779e6b
fix: improve condition to init context
2022-12-07 13:46:34 +05:30
Sagar Vora
7d47d10692
fix: override RestrictedPython transformer to allow _dict, revert frappe.as_dict
2022-12-07 13:45:28 +05:30
Sagar Vora
10695d3d49
feat: make context optional when calling render_template
2022-12-07 13:32:38 +05:30
Sagar Vora
f2e1dbe7eb
fix: restore _dict, used in Jinja code
2022-12-07 13:13:27 +05:30
Ankush Menat
d389fffbb7
feat: inter-process file locks ( #19133 )
2022-12-06 16:31:51 +05:30
Sagar Vora
9a3819e608
fix: disable signups by default ( #19114 )
...
* fix: disable signups by default
* fix: set `disable_signup` to `0` for tests
2022-12-05 16:40:51 +05:30
Sagar Sharma
cc9499c613
chore: typo in validate_loop msg ( #19091 )
...
* fix: typo in `validate_loop` msg
* chore: update translations
[skip ci]
Co-authored-by: Ankush Menat <ankush@frappe.io>
2022-12-03 12:08:41 +05:30
Ankush Menat
7d52df875f
perf(install): bulk insert country and currencies ( #19084 )
2022-12-03 12:03:05 +05:30
Ankush Menat
7a3faf23e1
Merge pull request #18664 from barredterra/csv-params
...
feat: configurable CSV delimiter and quoting
2022-11-29 13:27:24 +05:30
HarryPaulo
f25358ad63
fix: "_dict" is an invalid attribute name because it starts with "_" ( #19010 )
...
* fix: "_dict" is an invalid attribute name because it starts with "_"
* chore: move to frappe namespace
2022-11-29 11:43:23 +05:30
Raffael Meyer
83e2f524e2
Merge branch 'develop' into csv-params
2022-11-26 20:10:51 +01:00
barredterra
433b285b92
refactor: use provide_binary_file
2022-11-26 20:08:50 +01:00
Ankush Menat
d00b98f460
chore: typo
2022-11-25 13:10:43 +05:30
Ankush Menat
ed28626021
refactor: simpler deque strat selection
...
Co-authored-by: Ritwik Puri <ritwikpuri5678@gmail.com>
2022-11-25 12:14:37 +05:30
Ankush Menat
a8bf86ef75
feat: support dequeuing strategies for worker
2022-11-25 12:14:37 +05:30
Ankush Menat
aece93fbc5
feat: burst mode in workers
...
https://python-rq.org/docs/workers/#burst-mode
2022-11-25 12:14:33 +05:30