WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 5e02201

Browse files
authored
createlivecomponent.py: Create missing leaf __init__.py file as well (#28)
* createlivecomponent.py: Create missing leaf __init__.py file as well * createlivecomponent.py: Improve on variable name "parent_path"
1 parent 8a32b5c commit 5e02201

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

livecomponents/management/commands/createlivecomponent.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ def handle(self, *args, **options):
8686
component_path = app_path / "components" / component_name
8787
component_path.mkdir(parents=True, exist_ok=True)
8888

89-
# Create __init__.py files for all the parent directories of the component
89+
# Create __init__.py files for all the directories of the component
9090
# file down to "components" directory.
91-
parent_path = component_path.parent
92-
while parent_path != app_path / "components":
93-
init_py = parent_path / "__init__.py"
91+
package_path = component_path
92+
while package_path != app_path / "components":
93+
init_py = package_path / "__init__.py"
9494
if not init_py.exists():
9595
init_py.touch()
96-
parent_path = parent_path.parent
96+
package_path = package_path.parent
9797

9898
component_py = component_path / f"{proper_name}.py"
9999
component_html = component_path / f"{proper_name}.html"

0 commit comments

Comments
 (0)