Skip to content

Commit

Permalink
fix: 🐛 don't create __init__.py files when gathering pages (#26045)
Browse files Browse the repository at this point in the history
* 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

(cherry picked from commit 0a4ee1d)

# Conflicts:
#	frappe/website/router.py
  • Loading branch information
Mutantpenguin authored and mergify[bot] committed Apr 22, 2024
1 parent ddae585 commit 90a9175
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frappe/website/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,15 @@ def get_pages_from_path(start, app, app_path):
pages = {}
start_path = os.path.join(app_path, start)
if os.path.exists(start_path):
<<<<<<< HEAD
for basepath, _folders, files in os.walk(start_path):
# 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 basepath, folders, files in os.walk(start_path): # noqa: B007
>>>>>>> 0a4ee1d829 ( fix: 🐛 don't create __init__.py files when gathering pages (#26045))
for fname in files:
fname = frappe.utils.cstr(fname)
if "." not in fname:
Expand All @@ -126,7 +130,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

Expand Down

0 comments on commit 90a9175

Please sign in to comment.