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
eb4aa0a1f3
fix(handler): Use signature to fetch doc method structure
2022-12-15 13:47:05 +05:30
Gavin D'souza
cff0567faf
fix(print): Check doc permission before checking related info
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
3aa1d61f0d
fix(whitelisted)!: Raise TypeError instead of ValidationError for unaccepted param types
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
fa88d5f7d9
refactor(minor): User
...
- Add typing hints for enabling endpoint runtime checks
- Remove unused parameters from function def and usage
- Update docstring in APIs
- Remove (now) redundant isinstance checks
- Use cached get_system_settings instead of DB call (perf)
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
Gavin D'souza
ccbc833c6c
feat: runtime check via pydantic
...
handle localns stringified types
2022-12-15 13:47:05 +05:30
Ankush Menat
06becac459
fix(trim-database): Dont act on non-frappe tables ( #19292 )
2022-12-15 13:43:28 +05:30
Ankush Menat
e437d0aca2
test: test index after col change too
2022-12-15 13:39:25 +05:30
Ankush Menat
56e1bf31d7
fix: patch to delete duplicate uniq indexes
2022-12-15 13:36:28 +05:30
Ankush Menat
8df845ca35
fix: duplicate unique index when column is altered
2022-12-15 13:36:28 +05:30
Ankush Menat
d27ea5e6da
test: unique index on install and alter
...
There should always be 1 unique index.
2022-12-15 13:36:28 +05:30
Shariq Ansari
d64836c1c4
Merge pull request #19285 from barredterra/remove-unused-html-param
2022-12-15 13:19:01 +05:30
Shariq Ansari
445da1fa99
Merge pull request #19284 from barredterra/download-pdf-with-lang-and-letterhead
2022-12-15 13:12:59 +05:30
Shariq Ansari
7129418fda
Merge pull request #19286 from frappe/fix-has-content
2022-12-15 12:31:26 +05:30
Shariq Ansari
cbb620eb61
Merge branch 'develop' into download-pdf-with-lang-and-letterhead
2022-12-15 12:21:19 +05:30
mergify[bot]
8d9673d296
Merge pull request #19289 from pps190/fix-grammer
...
fix: grammar mistake in label
2022-12-14 15:03:53 +00:00
Devin Slauenwhite
b522da495e
fix: grammar mistake in label
2022-12-14 09:47:28 -05:00
Hussain Nagaria
da7fd35e49
fix: handle HTML code field's has_content
2022-12-14 19:36:07 +05:30
barredterra
22ea39a442
fix: remove unused html parameter
...
from `attach_print`and `get_print`
2022-12-14 14:37:56 +01:00
Shariq Ansari
378af5a883
Merge pull request #19283 from shariquerik/bump-editorjs
2022-12-14 18:35:19 +05:30
barredterra
67ede5d533
feat: add parameters language and letter_head to download_pdf
2022-12-14 13:59:46 +01:00
Shariq Ansari
5363e6db15
build(deps): Bump editorjs to 2.26.3
2022-12-14 18:12:26 +05:30
Shariq Ansari
a6cecf10b2
Merge branch 'develop' into bump-editorjs
2022-12-14 18:05:26 +05:30
Shariq Ansari
b10056f9cd
build(deps): Bump editorjs to 2.26.2
2022-12-14 18:03:27 +05:30
Shariq Ansari
090f55957e
Merge pull request #19280 from shariquerik/grid-custom-button-space
2022-12-14 17:48:38 +05:30
Shariq Ansari
4b1f65206f
fix: if grid custom button is not set grid has some extra space on top
2022-12-14 17:29:58 +05:30
Daizy Modi
9a8dbc42a7
fix: added a case with backticks
2022-12-14 17:01:19 +05:30
Daizy Modi
3e824a9ea5
test: test case for sanitize_searchfield
2022-12-14 16:47:23 +05:30
Daizy Modi
4d9be26ada
fix: use stricter regex for sanitize_searchfield
2022-12-14 16:11:04 +05:30
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
Devin Slauenwhite
1fc2639123
fix: hide toolbar label ( #19272 )
2022-12-14 11:03:51 +05:30
Shariq Ansari
6dab439f42
Merge pull request #19269 from shariquerik/web-form-print-format-fix
2022-12-13 18:57:44 +05:30
Shariq Ansari
55d3bea05b
Merge branch 'develop' into web-form-print-format-fix
2022-12-13 18:06:03 +05:30
Shariq Ansari
2767580732
fix: in web form if print format is empty getting error
2022-12-13 17:41:10 +05:30
Ankush Menat
b91354e28f
Merge pull request #19265 from ankush/prepared_report_sort
...
fix: sort keys in prepared report filters
2022-12-13 16:50:01 +05:30
Ankush Menat
004c716a67
fix: sort keys in prepared report filters
2022-12-13 16:24:11 +05:30
Ankush Menat
170b7c9b0f
chore: correct devel version
2022-12-13 14:20:55 +05:30
Ankush Menat
ee5c82e985
fix(DX): validate virtual doctype controllers
2022-12-13 14:18:19 +05:30
Ankush Menat
290a3df68d
chore!: drop backup.py direct calls + pragma nocov
2022-12-13 14:18:19 +05:30
Abdallah A. Zaqout
aa1f03239c
feat: allow user to pick all columns ( #19236 )
...
Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com>
2022-12-13 13:36:24 +05:30
Ankush Menat
494400ead2
style: fmt
...
[skip ci]
2022-12-13 12:07:04 +05:30
Babuuu
607b83de5c
fix: Change page title to app name. ( #19247 )
...
[skip ci]
2022-12-13 12:06:01 +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