This is sort of a breaking change? Because if an int/dict/list/tuple was
passed instead of a str, object doesnt have .startswith (AttributeError)
would be raised instead of just returning None.
get_timedelta returns None in case of invalid or imparsable inputs. This
behaviour is consistent wrt other utils. The util, to_timedelta tries to
convert to timedelta objects only if str object is passed. It returns
the same object if not string, which is absurd...given its called
`to_timedelta`.
Cast the value to the Python native object of the Frappe fieldtype provided. If value is None, the first/lowest value of the `fieldtype` will be returned.
Mapping of Python types => Frappe types:
* float => ("Currency", "Float", "Percent")
* int => ("Int", "Check")
* datetime.datetime => ("Datetime",)
* datetime.date => ("Date",)
* datetime.time => ("Time",)
Deprecate frappe.utils.data.cast_fieldtype in favour of new util cast
which handles types "better"
* 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
* feat: add number format parameter in fmt_money
* review fix: move new parameter at the end
Co-authored-by: Kenneth Sequeira <kenneth@Kenneths-MacBook-Air.local>
`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.
The timespan filter now considers calendar month, quarter,
half-year, and year for last and next timespans.
Signed-off-by: Syed Mujeer Hashmi <mujeerhashmi@4csolutions.in>