mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-02-09 08:00:50 +03:00
Protect from bad (non-importable) repo names, like those with dashes
This commit is contained in:
parent
8a3d36fe40
commit
3573272952
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"project_name": "project_name",
|
"project_name": "project_name",
|
||||||
"repo_name": "{{ cookiecutter.project_name|replace(' ', '_') }}",
|
"repo_name": "{{ cookiecutter.project_name|replace(' ', '_')|replace('-', '_') }}",
|
||||||
"author_name": "Your Name",
|
"author_name": "Your Name",
|
||||||
"email": "Your email",
|
"email": "Your email",
|
||||||
"description": "A short description of the project.",
|
"description": "A short description of the project.",
|
||||||
|
|
4
hooks/pre_gen_project.py
Normal file
4
hooks/pre_gen_project.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
repo_name = '{{ cookiecutter.repo_name }}'
|
||||||
|
|
||||||
|
if hasattr(repo_name, 'isidentifier'):
|
||||||
|
assert repo_name.isidentifier(), 'Repo name should be valid Python identifier!'
|
Loading…
Reference in New Issue
Block a user