fix: 🐛 don't create __init__.py files when gathering pages (#26045)

* fix: 🐛 don't create __init__.py files when gathering pages

These files are only necessary if any other *.py files exists in a pages folder. Apart from that, this functions purpose (by name) is to get pages, and not create any source code files.

closes #25167

* refactor: ⚰️ remove commented out code
This commit is contained in:
Markus Lobedann 2024-04-22 13:23:18 +02:00 committed by GitHub
parent 03de739107
commit 0a4ee1d829
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -110,10 +110,6 @@ def get_pages_from_path(start, app, app_path):
start_path = os.path.join(app_path, start)
if os.path.exists(start_path):
for basepath, folders, files in os.walk(start_path): # noqa: B007
# add missing __init__.py
if "__init__.py" not in files and frappe.conf.get("developer_mode"):
open(os.path.join(basepath, "__init__.py"), "a").close()
for fname in files:
fname = frappe.utils.cstr(fname)
if "." not in fname:
@ -128,7 +124,6 @@ def get_pages_from_path(start, app, app_path):
os.path.join(basepath, fname), app, start, basepath, app_path, fname
)
pages[page_info.route] = page_info
# print frappe.as_json(pages[-1])
return pages