Commit graph

2371 commits

Author SHA1 Message Date
gavin
4041442e6a
Merge pull request #13955 from gavindsouza/trim-db
feat: Site Maintenance commands
2021-09-15 17:08:40 +05:30
Gavin D'souza
3734b63c17 fix: Do partial backups instead of full in trim-database 2021-09-15 16:08:55 +05:30
Gavin D'souza
fb42d9f68c refactor: Query Builder over Raw SQL
Converted 3 (1 multisql + 2 simple updates) raw queries in frappe.utils.password
2021-09-14 18:37:13 +05:30
Gavin D'souza
713eaf6ac9 chore: Raise NotImplementedError in base Database class
Methods that have to be overridden should throw NoteImplementedError.
Helps during development :')
2021-09-14 18:36:01 +05:30
Gavin D'souza
f1c29a16eb fix: Invalid translation string 2021-09-14 14:52:05 +05:30
Gavin D'souza
53f92e5b5c refactor: Use Query Builder instead of raw queries 2021-09-14 14:50:26 +05:30
Gavin D'souza
1545ad65d1 fix: Don't need postgres to use Frappe
* Made code DRY-er by using obscure frappe.db.is_data_too_long
* Python would run psycopg import line which would check if postgres is
  installed. Sites just wanting to chill w MariaDB would also need
  Postgres to be installed to get Frappe running. Fixes https://github.com/frappe/frappe/issues/14193
2021-09-14 13:06:59 +05:30
Rushabh Mehta
20dea90670 feat(minor): Packages! also cleanup of DocField and other minor fixes 2021-09-05 22:01:55 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
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.
2021-09-03 12:02:59 +05:30
Gavin D'souza
65864c027f chore: Update module license header
These modules were imported from the ERPNext codebase into Frappe.
License header was overlooked at that point. These were contributed
initially by Frappe Technologies Pvt Ltd under GPLv3 (ERPNext's license) and now
we, as Frappe Technologies Pvt Ltd converting them to MIT to comply with
Frappe's license.
2021-09-03 11:51:01 +05:30
Faris Ansari
f23802d25b fix: Enable Server Scripts by default 2021-09-01 16:30:15 +05:30
mergify[bot]
386b579405
Merge pull request #13989 from gavindsouza/get-single-value-oof
fix(frappe.utils.data): Deprecate `cast_fieldtype` to use `cast` for consistent return types
2021-09-01 08:57:49 +00:00
gavin
8394bbeb4c
chore(utils): Add type hints for get_timedelta, getdate
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2021-08-31 21:50:07 +05:30
Gavin D'souza
9a32513b47 chore: Update frappe.utils.data.cast docstring 2021-08-31 13:11:25 +05:30
Gavin D'souza
176d6d2d06 fix: Check if input is str is_invalid_date_string
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.
2021-08-31 13:07:22 +05:30
Gavin D'souza
8622142d7d fix: Use get_timedelta in cast, add to safe_exec list
* Return date and datetime objects for Date and Datetime field types
  respectively if Falsy output is set
2021-08-31 13:06:10 +05:30
Gavin D'souza
3858e95e80 feat(utils): Add util get_timedelta
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`.
2021-08-31 12:57:05 +05:30
Gavin D'souza
7e2e8c87ff Merge branch 'develop' into get-single-value-oof 2021-08-30 13:49:35 +05:30
Gavin D'souza
b8c51b13e2 fix: Revert to using cast_fieldtype in BaseDocument.cast
* reference: revert Breaking Change -
  https://github.com/frappe/frappe/pull/13989#discussion_r695624003
* Show deprecation warning unless `show_warning` is unset
2021-08-30 13:45:30 +05:30
Gavin D'souza
783165c01e fix: Retry get_redis_conn until "sure"
If ConnectionError or BusyLoadingError occurs, try every second for
up-to 10 times.

Why: `bench start` exits just as i run it at times. This happens when
the worker's processes each try to fetch a redis conn but redis isnt up
yet. The 3 workeer processes exit with 1 and our procman gives up too.
2021-08-30 12:00:31 +05:30
Suraj Shetty
30a09490b5
Merge branch 'develop' into get-frmt 2021-08-27 11:12:27 +05:30
Gavin D'souza
a2cb9be7a4 feat: frappe.utils.data.cast
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"
2021-08-20 12:35:24 +05:30
Gavin D'souza
cb034e4c52 fix: Consistent return types in cast_fieldtype
Note: BREAKING CHANGE
2021-08-20 12:08:39 +05:30
Suraj Shetty
1cf1bc1e06 refactor: Remove unused functions 2021-08-19 17:48:40 +05:30
Suraj Shetty
44c82276e8 refactor: Remove unused methods 2021-08-19 17:37:01 +05:30
Suraj Shetty
a7fb1816aa refactor: Remove unused and redundant code 2021-08-19 15:27:25 +05:30
Gavin D'souza
30cf8fd58d refactor: Use run instead of frappe.db.sql 2021-08-12 18:36:43 +05:30
Gavin D'souza
1015283731 fix(global_search): Typecast variable for comparision
Previously start was being type casted with int. That was reverted by refactoring query to use new Query Builder
This bug was introduced via ee3c84beef
2021-08-12 16:23:40 +05:30
Suraj Shetty
1d878199f1
Merge pull request #13899 from surajshetty3416/fix-print-format-header 2021-08-10 11:05:35 +05:30
mergify[bot]
afd69729de
Merge pull request #13835 from MitulDavid/image-processing
feat: Image cropping and optimization
2021-08-10 05:16:08 +00:00
Suraj Shetty
291d7b0f16 fix: Call is_rtl function to get the actual value 2021-08-10 10:13:19 +05:30
Afshan
c7ad1be6b8 fix: format string for formating date 2021-08-06 22:10:37 +05:30
Mitul David
4f86cdb8f8
Merge branch 'develop' into image-processing 2021-08-06 18:45:59 +05:30
MitulDavid
2d887187d2 refactor: Toggle optimization using checkbox 2021-08-06 18:31:41 +05:30
Ankush
257723cb0a
feat: PythonExpression and Python option with syntax validation for Code field types (#13707)
* feat: `PythonExpression` and `Python` options for `Code` fields

* fix: check python expressions in assignment rule

* fix: replace server script syntax validation

* fix: validate condition in workflow transition

Add PythonExpression in Options.
2021-08-06 04:10:09 +00:00
Mitul David
fa6e26f5e1
Merge branch 'develop' into image-processing 2021-08-05 16:41:00 +05:30
Suraj Shetty
af30607719
Merge branch 'develop' into remove_bg_queue 2021-08-04 15:12:47 +05:30
Suraj Shetty
81cada8b6e
Merge branch 'develop' into get-frmt 2021-08-04 14:20:21 +05:30
Ankush Menat
7994706bdb fix: remove unused queue
Removed because causes unnecessary confusion. A queue called
"background" never existed it was commited by mistake while developing a
feature but that feature ended up not using it.

reference commit: e6adf91029
reference PR: https://github.com/frappe/erpnext/pull/26701
2021-08-02 19:00:26 +05:30
gavin
4d38093f6c
Merge pull request #13694 from deepeshgarg007/api_update
fix: Error on updating docs via API
2021-08-02 18:58:33 +05:30
MitulDavid
a3430ca2a9 feat: Image optimization 2021-08-02 18:23:26 +05:30
Gavin D'souza
f7b8f86666 Merge branch 'develop' of github.com:frappe/frappe into aks-orm 2021-07-30 13:10:59 +05:30
Gavin D'souza
43cde90109 fix(backups): Allow individual backups of all tables
Due to previous logic, only tables under DocType table were allowed to
take partial backups. This change allows backup to be taken for
deprecated doctypes too.
2021-07-30 12:28:27 +05:30
Gavin D'souza
94701fdb7d feat(utils): frappe.utils.get_table_name
Fetch table name from doctype/__ table name passed
2021-07-30 12:27:22 +05:30
saxenabhishek
42dc8a180f refactor: get_table_name, run_only_if 2021-07-30 11:48:12 +05:30
saxenabhishek
7671e78487 style: minor fixes and improvements 2021-07-30 11:29:41 +05:30
saxenabhishek
ce10e36725 refactor: move all pypika functions to a module 2021-07-30 11:00:35 +05:30
saxenabhishek
ee3c84beef style: typecast to string inside db.sql 2021-07-30 11:00:35 +05:30
saxenabhishek
c05a032811 refactor: qb in global_search.search 2021-07-30 11:00:34 +05:30
Leela vadlamudi
2c659e1bce
Merge pull request #13746 from leela/rq-auth
feat: Redis Authentication and namespaces for Redis queue instance
2021-07-30 09:07:31 +05:30