Sagar Vora
036574f547
fix: patch to remove share on existing sites
2022-12-17 07:57:02 +00:00
Sagar Vora
1684996e9f
fix: dont share with self for standard users
2022-12-17 07:57:02 +00:00
Sagar Vora
9ad9c39d25
test: improve doctype and field naming
2022-12-17 07:56:54 +00:00
Sagar Vora
c453ad2d97
perf: reuse _doc_before_save in doc.get_latest
2022-12-17 07:56:54 +00:00
Sagar Vora
1fbead137c
chore: ignore vuln GHSA-hcpj-qp55-gfph during pip audit ( #19328 )
2022-12-17 11:51:23 +05:30
Ankush Menat
4f6e62a96e
ci: bump black to latest ( #19319 )
...
[skip ci]
2022-12-16 15:14:37 +05:30
Devin Slauenwhite
64ec4276fc
fix: restore missing helpful and not_helpful fields to help article doctype. ( #19309 )
...
* fix: restore fields 'helpful' and 'not_helpfull' when removed via 02ddaa5ee7 \#diff-3e0e1befb66af4c2ab84c6fe0e996dc602d906817f0b00b6239120af9da9be46
* test: help article is helpful or not helpful
* chore: linter
2022-12-16 12:34:52 +05:30
Sagar Vora
6fe9f9b411
test: remove duplication in test_search
2022-12-16 10:21:50 +05:30
Ankush Menat
8140908f99
style: format
...
[skip ci]
2022-12-15 21:57:52 +05:30
Mohammad Hussain Nagaria
8f8f506b10
feat: fields for attaching (html) meta tags in web form ( #19306 )
2022-12-15 21:07:10 +05:30
Ankush Menat
c0e5408659
Merge pull request #19277 from resilient-tech/refactor-sanitize_searchfield
...
fix: use stricter regex for `sanitize_searchfield`
2022-12-15 17:47:07 +05:30
Ankush Menat
8107781f1c
fix: move filelock imports to functions ( #19300 )
2022-12-15 15:21:31 +05:30
Gavin D'souza
e3f82f0175
fix: Maintain test_password_strength signature
...
Add deprecation warning instead of removing params directly
2022-12-15 14:11:44 +05:30
Ankush Menat
9b2283092e
test: another test case for index duplication
2022-12-15 14:11:26 +05:30
Gavin D'souza
009936dbac
fix: Pass _lang in get_raw_commands API call for Frappe WSGi
...
Revert unintentional change
2022-12-15 13:47:05 +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
029a1fc902
chore: Remove loose types from fn definitions
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
2327a56abc
fix(File): Correct acceptable types in APIs
...
- Allow str types for start, page_length in page_length API
- Allow str, list[dict] file_list in move_file API
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
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