refactor: clean up code to py39+ supported syntax
- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes
Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
* Remove six for PY2 compatability since our dependencies are not, PY2
is legacy.
* Removed usages of utils from future/past libraries since they are
deprecated. This includes 'from __future__ ...' and 'from past...'
statements.
* Removed compatibility imports for PY2, switched from six imports to
standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
Given the scope of its usage at this point, this becomes a problem when you'd have a field named y,n, true, false and order_by that field, or have the same values for a document name that parent parameter would accept out of all those that Frappe REST allows.
`GET /api/resource/ToDo?limit=10&debug=False&as_dict=0` would be received by the resource handler as debug="False" and as_dict="0" which are both truthy values.
So, even though you requested for a list of lists response without debugging on, you'd get the exact opposite; debug on and a list of dicts.
- Evaluate boolean values for `GET /api/resource/<doctype>`
- Added `limit` parameter as an alias for `limit_page_length`
- Added `frappe.utils.data.sbool` that converts strings to bool values if applicable.
- Added some seemingly stupid comments for the sake of consistency.
* do not overwrite user if it's already set
* Update frappe/api.py
* chore: fix syntax error and translation syntax
Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
* fix: REST API utf-8 decoding on creates/updates
Creating or updating a document via the REST API would generate an error of:
`TypeError: the JSON object must be str, not 'bytes'`
Because get_data() returns bytes which must be explicitly converted to a string before parsing as JSON.
Defect introduced by efe94886a and a71a92341e
* fix: switch to safe_decode
* token based authentication
* authentication
Basic base64encode(api_key:api_secret)
token api_key:api_secret
* test added
Validation: only user with system manager can generate the keys
* codacy issues fixed
* token based authentication
* authentication
Basic base64encode(api_key:api_secret)
token api_key:api_secret
* test added
Validation: only user with system manager can generate the keys
* codacy issues fixed
* use frappe.safe_encode
* base64 encode use frappe.safe_encode
* set frappe.local.form_dict after setting user
* removed test
* removed unused imports
* test for python 3
* Update user.js
* [user.py] throw correct error
* Update user.py
* [fix] remove razorpay from integration service
* [fix] clean-up js side integration service dependancies
* [fix] remove integration service, .py cleanup, move integration request to integration
* [fix] move oauth to integrations and deprecate integration broker
* [fix] mark services enabled and update integrations listing
* [fix] V7.1 and V7.2 integration service related pathch fixes and move payment gateway dotype to core module
* [fix] create payment gateway records if not exists
* [fix] module page for integrations
* [minor][fix] minor checks
* [fix] remove integration broker module only if not allocated to any doctype