Commit graph

281 commits

Author SHA1 Message Date
Gavin D'souza
ffb2aceb43 fix: Logical bug in DatabaseQuery.extract_tables
Introduced via 888aa8ad84
2021-06-15 12:50:29 +05:30
Gavin D'souza
1b6c41cbfc fix: Don't re-define pluck bug
Introduced via 974bf463df
2021-06-11 19:44:22 +05:30
Gavin D'souza
f92c5d9898 refactor: Unnecessary/illogical check
because cint(False) gives 0
2021-06-11 19:34:34 +05:30
Gavin D'souza
888aa8ad84 refactor(minor): DatabaseQuery.extract_tables 2021-06-11 19:34:24 +05:30
Gavin D'souza
ee75fb38cc style: Restructured if blocks in db_query 2021-06-11 19:34:16 +05:30
Gavin D'souza
974bf463df refactor: Simplify string representations
* Simplify existing %s, .format representations to f-string
* Simplify logic
* Remove redundant tokens
2021-06-11 19:34:00 +05:30
Gavin D'souza
c489846547 Merge branch 'develop' into unnecessary_comprehensions 2021-06-11 19:30:23 +05:30
Brian Pond
d8113698d1
bug: db_query.py
The object 'meta' does not always have the attribute 'is_submittable.'
This extra syntax checks for existence first.
2021-06-07 16:15:59 -07:00
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* 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
2021-05-26 15:31:29 +05:30
Ankush Menat
4754ab71d1
perf(minor): remove unnecessary comprehensions
- remove several unnecessary comprehensions from functions that accept a generator.
- Using `[x for x in iter]` causes a list to be built first then passed to the outer function.
- `any` and `all` can take generator instead. This makes memory usage O(1) and actually makes these functions short-circuiting. E.g. if the first condition fails then `all` will immediately return false instead of evaluating all the entries.
- `sum`, `min`, `max` => memory usage become O(1)
- `list`, `set`, `.join()` => roughly halves memory usage, as list is not required to be built.
- lastly, it's two fewer characters to read/think about.
2021-05-12 20:38:18 +05:30
leela
72ca7e9753 refactor: remove six dependency 2021-05-07 07:42:04 +05:30
Deepesh Garg
8460ca851f fix: filter list view based on owner 2021-04-03 16:12:26 +05:30
Rushabh Mehta
2248c6c410 fix(minor): lockdown frappe.client.get_list 2021-03-30 11:25:40 +05:30
Rushabh Mehta
c9b367933a fix(minor): make group_by validation tighter 2021-03-29 23:16:33 +05:30
Rushabh Mehta
a2ffea53f2 fix(refactor): lockdown frappe.desk.reportview 2021-03-29 21:44:08 +05:30
prssanna
94db4b6c3d Merge branch 'develop' of https://github.com/frappe/frappe into rebrand-ui 2021-02-01 20:41:34 +05:30
Saurabh
d120ca7f9e
fix: validate user perms if user has select perm (#12289) 2021-02-01 17:43:24 +05:30
Suraj Shetty
b94d5778a8 Merge branch 'develop' of https://github.com/frappe/frappe into rebrand-ui 2021-01-19 10:36:50 +05:30
Saurabh
97b693c6b0
feat: Added permission to grant only Select access to document (#12063)
* feat: add permtype 'select' to DocPerm and CustomDocPerm

* feat: add 'select' perm in rights tupple

* feat: provisions to handle select permission

* feat: toggle href based on permissions

* feat: pass permission type explicitly while validating link in permission check

* fix: sider

* feat: added test cases to validate select perm

* feat: add method frappe.only_has_select_perm to explicitly check the select perm

* fix: if user only has select perm then do not show anchor tag for link fields

* fix: sider
2020-12-29 16:58:28 +05:30
Rushabh Mehta
40025e2a70 fix(minor): fix login style and routing for calendar, navbar 2020-12-14 22:35:08 +05:30
Faris Ansari
9ac14fb5ab feat: Permission Query script type
Add dynamic conditions in where clause of get_list query
2020-12-03 23:26:34 +05:30
Rushabh Mehta
97191f90af fix(minor): dont run a query when table is missing 2020-10-27 23:02:11 +05:30
Rushabh Mehta
69d2c10736 fix(minor): db_query (ignore_ddl) 2020-10-26 10:02:04 +05:30
Rushabh Mehta
742605542c fix(minor): added ignore_ddl in frappe.db.get_all to ignore missing tables, columns 2020-10-26 10:02:04 +05:30
Gavin D'souza
cf1b01fb5e fix: Remove partial support for distinct keyword
* Added supporting sql functions and distinct kw in TODO
2020-10-12 15:34:48 +05:30
Gavin D'souza
b00a389cfd fix: Add provision for quotes in DatabaseQuery.prepare_args 2020-10-09 19:40:45 +05:30
marination
d39216b273 fix: Select only last 3 args 2020-10-07 15:46:39 +05:30
Aditya Hase
e6c16f3184
fix(db_query): Allow plucking a field without having to add it to the fields list
e.g.

frappe.get_all("ToDo", pluck="owner")

Didn't work before, instead

frappe.get_all("ToDo", fields=["owner"], pluck="owner")

was needed
2020-10-06 18:32:43 +05:30
mergify[bot]
3275cc4c5a
Merge pull request #11500 from gavindsouza/mysql-syntax-error
fix(doctype): Allow MySQL keywords as Docfields
2020-09-24 08:45:34 +00:00
Gavin D'souza
31bf172f73 fix: Check if as token in statement explicitly
tests failing due to this conditon becoming truthy for value: "assignment_rule"
2020-09-23 15:15:26 +05:30
Faris Ansari
ed9abe0d7c fix: Pluck syntax for get_all and friends 2020-09-23 12:55:16 +05:30
Gavin D'souza
ef276257d4 fix: Handle mysql functions and "as" 2020-09-18 21:51:44 +05:30
Gavin D'souza
b6f6bbadb0 fix: Allow keywords as fieldnames 2020-09-18 12:58:28 +05:30
mergify[bot]
cbf1077490
Merge pull request #11475 from prssanna/empty-tree-filter
fix: handle undefined tree filter value
2020-09-11 15:19:14 +00:00
prssanna
a429729e92 fix: handle undefined tree filter value 2020-09-10 12:57:34 +05:30
Aditya Hase
555c52fc70
fix(db_query): Reject user argument in whitelisted methods 2020-09-07 18:56:24 +05:30
Chinmay Pai
e30161b222
fix: disallow global variable access through sql (#10875)
* fix: disallow global variable access through sql

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
Co-authored-by: Sahil Khan <sahilkhan28297@gmail.com>

* chore: add test for sql disallowed variable access

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>

Co-authored-by: Sahil Khan <sahilkhan28297@gmail.com>
2020-07-10 13:55:06 +00:00
prssanna
1b691c799d refactor: refactor get_date_range 2020-06-01 10:52:07 +05:30
prssanna
d9e8b7ef4f fix: handle old date filters in query 2020-06-01 10:51:38 +05:30
prssanna
f7f2be5926 fix: rename function 2020-06-01 10:51:38 +05:30
prssanna
4b2d730a8c fix: variable naming 2020-06-01 10:51:38 +05:30
prssanna
6495ee2426 style: fix formatting 2020-06-01 10:51:38 +05:30
prssanna
2fcd8c2905 fix: move timespan function to data.py 2020-06-01 10:51:38 +05:30
prssanna
f0d62d4007 fix: all periods in timespan filter 2020-06-01 10:51:38 +05:30
prssanna
4c16b2a608 feat: api to get additional filters 2020-06-01 10:51:38 +05:30
prssanna
53e2e60cab feat: filter for current timespan 2020-06-01 10:51:38 +05:30
prssanna
cfdc24aef5 fix: dayofyear unit function for child table query 2020-02-28 13:00:04 +05:30
prssanna
946990d531 fix: set filter button for all chart types 2020-02-28 13:00:04 +05:30
prssanna
6977025614 fix: child table filters for dashboard charts based on doctype 2020-02-28 13:00:04 +05:30
Shridhar
b3b70f3b7f Bug fixed ID value should not be set to 0 by default 2019-12-11 09:21:17 +05:30