Commit graph

2908 commits

Author SHA1 Message Date
Ankush Menat
338ccc5a2a
fix: sanitize form dict in error logs (#19835)
[skip ci]
2023-01-30 15:22:21 +05:30
RJPvT
8be98718f7
fix: ldap with 2fa (#19753)
Because we pop password 2fa fails when used with ldap

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-01-30 14:44:53 +05:30
Ankush Menat
70ee9272b1
fix: sanitize traceback for common secrets (#19805) 2023-01-27 12:44:33 +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
Ankush Menat
c24cd12a27
Merge pull request #19755 from gavindsouza/maxsplit-as-needed
refactor: Add a maxsplit limit to string splits
2023-01-25 11:10:48 +05:30
Gavin D'souza
d357af1533 refactor: Add a maxsplit limit to string splits 2023-01-24 19:22:51 +05:30
barredterra
2148dc745e refactor: assign instead of update 2023-01-24 13:51:47 +01:00
barredterra
e61d87827b refactor: imports
- remove unused imports
- import only the required patterns, not the entire file
2023-01-24 13:50:17 +01:00
barredterra
d5a72b16ce fix: trim long passwords before check
In order for the check to pass in a reasonable amount of time.
2023-01-24 13:48:07 +01:00
Ankush Menat
87561940a4
feat: Interactively add a new patch (#19722) 2023-01-23 15:04:43 +05:30
Richard Case
0e6e2609b5 fix: unhelpful error message (#19666) 2023-01-23 14:48:27 +05:30
Sagar Vora
05c03a9345 chore!: remove cache_locally parameter 2023-01-21 17:32:24 +05:30
Richard Case
b66f93bdf5
feat: allow 'content' attribute for website structured data schema (#19667) 2023-01-20 14:37:18 +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
e31db5d502
fix: handle tel: links in emails (#19635) 2023-01-17 20:31:06 +05:30
Suraj Shetty
bc13f909fb
fix: Argument name should be letterhead instead of letter_head (#19627)
fixes https://github.com/frappe/frappe/issues/19515
2023-01-17 18:10:23 +05:30
Ankush Menat
5e2bbf834f refactor: filter out apps not installed on bench 2023-01-16 13:54:40 +05:30
Sagar Vora
d8b7bc18d7 refactor!: deprecate sorting based on apps.txt in get_installed_apps 2023-01-16 13:54:27 +05:30
aissa-berrachiche
bfaadfd32d
fix: passwords are updated on every login (#19594)
Co-authored-by: aberrachiche <aberrachiche@aas.com.sa>
2023-01-16 11:06:05 +05:30
Ritwik Puri
27a2689678
fix: slug doctype when building url to report with filters (#19581) 2023-01-12 23:36:46 +05:30
Ankush Menat
278a56417b fix: logging type annotations
closes https://github.com/frappe/frappe/issues/19521
2023-01-10 00:02:44 +05:30
Faris Ansari
f982439eb9 fix: pass fields explicitly
- to prevent addition of default `name` field
- also, add fields only if it is a select query
2023-01-09 16:43:44 +05:30
Faris Ansari
be654eaa60
Merge branch 'develop' into refactor-qb-engine 2023-01-09 15:23:20 +05:30
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
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
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