User might only have "only if creator" permission so checking on doctype
will incorrectly flag it.
Not sure if there's any better/simpler way to handle this. This is weird
edge case on how files operate.
If I have to hazard a guess, 99% API calls are not server scripts, then
why check it first and pay the costs?
This PR first checks if method is a real method in python code and if
it's not found then only attempts to fetch it from server script map.
I'll revert this if I can bring the costs in acceptable limits with
client-side caching.
* feat: Add deprecation_dumpster.py file
* docs: add jovial and jocose docstring for frappe/deprecation_dumpster.py
* refactor: fill the dumpster with its own kind
* refactor: move to the deprecation dumpster
* chore: color coding class
* fix: only check import error when import errors
Use case:
- User has "if owner" perm
- Doc isn't created
- We skip doc perm check because doc doesn't exist
- We check if user has write perm to doctype, which isn't available
because it's only "if owner"
Fix: We can avoid perm check entirely here, files are only re-attached
if doc saves successfully which implies that reference doc was indeed
saved after perm check.
* feat(safe_exec): allow usage of `print()`
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* refactor(system_console): update description to mention `print()` instead of `log()`
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* feat: unconditionally add debug logs to response if present
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* chore(safe_exec): add in a test for running `print()` within safe_exec
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* fix(safe_exec): ignore warning
RestrictedPython warns us if we call `print()` don't use their `printed` variable
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* feat: store debug logs from scheduled jobs
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* fix: avoid ignoring warnings, disabled in prod anyway
* chore: remove unnecessary logging
This can be moved to level 2 when required
---------
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: Ankush Menat <ankush@frappe.io>
name is used in many places and should not be overwritten,
so i have sent name in upload_via_file_browser as library_file_name
which can be used to get existing file.
Previously, the attach from library only shared file_url, problem is we
need more information such as is_private.
fix: send name instead of file_url on file uploader and use that in
upload_file handler to get more information about the file then attach
that info to newly created file.