seitime-frappe/frappe/model
mergify[bot] 53a2539c5a
feat(minor): Implement __getitem__ in Base Document (#14855) (#14866)
* feat(minor): Implement __getitem__ in Base Document

This addition allows for syntactic sugars like writing doc["name"] to
access document name. This addition is solely for the sake of code
simplicity. Since dictionaries in Python follow this standard, we can
write code that works for both Vanilla Dicts, Frappe Dicts & all
Document objects

* fix: Use getattr over get in getitem

For the sake of consistency and some level of sanity in the universe.

Co-authored-by: Ankush Menat <ankush@frappe.io>

* fix: Raise KeyError instead of AttributeError

why: shit breaks down. Specifically stuff in Jinja templates, attributes
that are conditional. Either this is acceptable or subscripting objects
cannot and probably should not be possible along with our pre-condiitons

* chore: Use hasattr instead of get default

Couldn't decide between a style commit or a chore

Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit 583a7ef23923d362c85beeabe57703c2d5b12a65)

Co-authored-by: gavin <gavin18d@gmail.com>
2021-11-02 13:24:36 +05:30
..
utils chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30
__init__.py Merge branch 'develop' of https://github.com/frappe/frappe into form-tab-break 2021-09-04 15:37:58 +05:30
base_document.py feat(minor): Implement __getitem__ in Base Document (#14855) (#14866) 2021-11-02 13:24:36 +05:30
create_new.py chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30
db_query.py fix: If column comparision is done, dont check for ifnull/coalesce 2021-10-29 14:19:28 +05:30
delete_doc.py chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30
docfield.py chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30
document.py chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30
dynamic_links.py chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30
mapper.py chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30
meta.py fix: Table view for bench trim-tables 2021-09-14 21:53:02 +05:30
naming.py feat(minor): Packages! also cleanup of DocField and other minor fixes 2021-09-05 22:01:55 +05:30
rename_doc.py fix: simplify merge condition statement 2021-10-13 11:26:24 -04:00
sync.py docs: add docstring for import_file_by_path 2021-10-12 17:15:12 +05:30
workflow.py chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30