Commit graph

37 commits

Author SHA1 Message Date
Sagar Vora
09d0abcb54 fix: simplify load_from_db logic 2025-03-15 16:14:55 +05:30
David Arnold
3fe8a0d35e
docs: docstring on simple singledipatch util (#28437) 2024-11-12 11:52:19 +01:00
Sagar Vora
30abcf66e8
fix: escape backslashes in repl to prevent syntax errors (#28052) 2024-10-09 14:28:14 +05:30
David Arnold
5d3697500e
refactor: improve maintainability with a simple dispatcher (#27975)
* refactor: improve maintainability with a simple dispatcher

* refactor: improve maintainability with a init dispatcher on Document

* refactor: improve maintainability with an init dispatcher on meta
2024-10-06 16:56:40 +00:00
Ankush Menat
76096f5fb8
perf: use meta for virtual and single checks (#25620)
RQ workers spawn a new process for every job so site_cache does
nothing to prevent repeated queries.
2024-03-26 13:10:15 +05:30
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
barredterra
cc6ff2994f fix: make render_include work without local object
frappe.throw relies on local, making it impossible to use this function without an active site.
2024-01-19 16:13:09 +01:00
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Ankush Menat
8155371162
fix: ignore DOCTYPES_FOR_DOCTYPE in issingle check (#21375) 2023-06-14 18:21:55 +05:30
Ankush Menat
3f3ee12338 Revert: keep supporting set_value for singles
w/ explicit check for singles

This shouldn't have any performance impact as last function call only
happens if we THINK it's single doctype. use set_single_value to avoid
that extra function call.
2023-06-14 17:30:32 +05:30
Gavin D'souza
9d236fc2cc fix: handle missing is_virtual column via is_virtual_doctype 2023-01-31 15:31:24 +05:30
Ankush Menat
61a9349789 perf: use is_virtual_doctype and remove limit
This reduces 1 query for each child table read

Removed limit cause with 1000+ doctypes in frappe+erpnext this cache
will just keep getting trashed for no reason. There's clear upper bound
on size so no need to limit it here.
2022-08-21 17:37:40 +05:30
Sagar Vora
f9bfbfec98
perf: reduce DB calls made in get_fetch_values (#17671)
* perf: reduce DB calls made in `get_fetch_values`

* fix: ensure return value is same as before

* test: add test for `frappe.model.utils.get_fetch_values`
2022-08-05 11:52:37 +05:30
Ankush Menat
2e85a49fd2
refactor: remove test doctype from core (#17598)
This was commited by mistake, instead of using the test doctype, create
it on demand for tests.
2022-08-01 19:05:13 +05:30
Ankush Menat
e88bc35cae refactor: move is_virtual_doctype to relevant file 2022-07-22 14:25:48 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
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
2022-07-01 11:51:05 +05:30
Gavin D'souza
b696fa6da5 perf: Pre-compile and re-use regexp pattern
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
2022-06-08 14:07:38 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +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
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
Anurag Mishra
570fd44248 fix: Translating Errors and Messages 2019-07-03 11:52:47 +05:30
Zarrar
e76b3eef4e [Enhance] New DocField - 'Fetch From' (#5563)
* add new docfield fetch_from - serves as add_fetch

* replace options.split with fetch_from.split

* copied data from options to fetch_from

* patch to update fetch_from for docfield, custom_field and property_setter

* update tests according to fetch_from change
2018-05-23 11:07:57 +05:30
Achilles Rasquinha
496a63f07f fix _cast_result 2018-04-02 14:23:20 +05:30
Achilles Rasquinha
b4be0a79c1 fix timestamp mismatch for all singles 2018-03-31 17:34:36 +05:30
Achilles Rasquinha
6598be192f cast for standard fieldnames 2018-03-31 14:57:42 +05:30
Achilles Rasquinha
4433250cda Python 3 fixes 2018-02-13 12:27:02 +05:30
Aditya Hase
e6bd1e4995 Replaced all instances of 'unicode' with 'six.text_type' (#3825) 2017-08-02 16:57:39 +05:30
Rushabh Mehta
6a725d6c95 [cleanups] 2017-06-22 18:21:48 +05:30
tundebabzy
6e29d9e925 xrange to range (#3237)
* introduces build status for local fork

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range

* converts xrange to range using six.moves.range

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* converts xrange to range using six.moves.range7

* Revert "introduces build status for local fork"

This reverts commit 61f40983d0b3c6725369171ab850a18e5c029cc4.
2017-05-11 10:55:34 +05:30
tundebabzy
7b41d7e5eb Python 3 compatible print statements (#3199)
* changes print statements in file to python 3 compatible style using `__future__`

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* changes deprecated md5 module to hashlib

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements

* adds python 3 style for print statements
2017-05-01 12:34:29 +05:30
Rushabh Mehta
863aebcc78 [fixes] for translation and save full url for 404 2016-07-25 11:01:28 +05:30
Rushabh Mehta
349a65402f [website] fixes for generating docs 2016-06-23 18:22:03 +05:30
Anand Doshi
9c5e1199de [css] cleanup + moved products and homepage to erpnext + [fix] get_js 2016-04-22 18:52:47 +05:30
Rushabh Mehta
b902d1e8cc [enhancements] now can {% include %} in page js files and also write jinja like tags in js templates 2016-04-21 19:00:07 +05:30
Rushabh Mehta
daa9c094d0 [enhancement] [wip] links menu in forms 2016-04-12 19:16:17 +05:30
Rushabh Mehta
78607beeee [cleanup] print format css and default print view 2016-04-06 15:29:55 +05:30
Rushabh Mehta
56b2317ea0 [fix] property setter for idx 2015-07-10 20:32:54 +05:30