Converted all possible usages of re.* that weren't compiling the regex
separately and re-using it. Separated out the compiled patterns as
global variables. Repetitive patterns could be made DRY-er.
Would be nicer to have all regexes in a single module so that we could
re-use better, keep track of outdated, and keep checks for possible
reDos' etc
* fix: misc fixes
local.x gets resetted on every request so switched to a simple dict
simplified is_val_used in set_next_val function for sequences
* chore: use multisql for sequence methods
* fix: fields not updating on form
* minor(base_input): removed unnecessary branching in update_input
* chore: remove prints and rename autoincremented_status_map
* chore: added proper type hint + comment + formatting
* fix: added searching in cast_name rather than handling it manually
* fix: share condition query + test_build_match_conditions
* fix: add cast_name to more places
* test: test for sequence
* fix: sequence functions
* fix: inherit frappetestcase
* minor: attach sequence methods to db context local
* chore: update sequence function names in Database
use frappe.db for sequences in naming.py
* fix: convert filename to str (for autoincremented doctypes)
* chore: better regex for modifying values for postgres
* minor: allow changing name column type (if no data is present in the doctype)
* refactor: validate_autoname
converted it to a simple function
enabled changing autoincrement autoname from customize form
* fix: use sql_ddl for change_column_type in postgres
* fix: use not null constraint in postgres when changing name type
* fix(test): updated test_autoincremented_doctype_transition with transitioning when no data is present
* fix(test): updated test_cast_name
probably messed up during rebase
* fix(test): used rollback upon error in transaction for postgres
* chore: use frappe.db.x methods for sequences
* minor: use temporary sequences in test
* minor: use generate_hash for sequence naming in sequence tests
* chore: replace sequence imports with frappe.db.x
* chore: move out casting name fields to a separate method
* refactor: cast_name
more explicit cases for casts and added docstring
* fix: added space in test_cast_name
* chore: fix linter
* chore: better naming for can_change_name_column_type
* chore: add comment for autoincremented_site_status_map
* chore: update/add docstrings
* feat: log errors on too many writes to ease debugging
* fix(ux): extract and show which app/file/function caused too many writes
* fix: postgres error checking assumes exception is postgres exception
* fix: better default for skipping frames
Typically stack is like: some_app -> your_function -> this function. So last 2 frames need to be skipped.
* fix: postgres error checking assumes exception is postgres exception
* fix: better default for skipping frames
Typically stack is like: some_app -> your_function -> this function. So last 2 frames need to be skipped.
* refactor: show Report button instead of logging
* revert: unnecessary new functionality
* test: assert exact exception
Co-authored-by: Ankush Menat <ankush@frappe.io>
* Handle inconsistencies in type handling in DatabaseQuery & Database
APIs
* Update incompatible queries with frappe.qb notation
* Fixed use cases discovered by failing ERPNext CI tests
fix: db independent syntax for user_type
fix: handle postgres datetime values
feat: add ability to auto commit on db inserts
feat: add ability to escape underscore in postgres
fix: handle missing data in test runner bootstrapping
fix: db independent syntax for queries
fix: refactor to use qb
fix: update cache for language
fix: use pluck in email_queue
Co-authored-by: gavin <gavin18d@gmail.com>
fix: don't auto insert on tests for make_property_setter
fix: remove auto_commit in custom_field insertion
fix: remove auto_commit functionality
fix: review comments
fix: revert link validation
fix: style suggestion for readability
Co-authored-by: gavin <gavin18d@gmail.com>
fix: revert .lower() in link validation
fix: add rollback for setup_wizard
Revert "fix: add rollback for setup_wizard"
This reverts commit 83b3b0913db17718ccd5edae01858cff15603829.
Revert "feat: add ability to escape underscore in postgres"
This reverts commit 8ed9c2aa3306438e94bb813f60e65b416d0b947b.
fix: more concise representation of order fields
Co-authored-by: gavin <gavin18d@gmail.com>
* updated change_column_type to allow making columns nullable.
* breaking change: in postgres the method was previously nullable by
default, changed it to be consistent with mariadb.
Currently we use DECIMAL(18, 6) datatype for float, currency and
percent. But in the system settings we provide a configuration to change the
precision up to 9 digits. This obviously does not work because we do not
store 9 digit precision in database. Fixed by changing the decimal
datatype scale.
* 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
* 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