Skip to content

Loading…

Verification for the project name #35

Merged
merged 2 commits into from

3 participants

@DNX

Added verification for the project name in setup_project command as django's startproject command do.

@brosner
Pinax Project member

Please use double quotes.

@lukeman
Pinax Project member

Thanks Darii.

@lukeman lukeman merged commit 5e72ace into pinax:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 5 additions and 1 deletion.
  1. +5 −1 pinax/core/management/commands/setup_project.py
View
6 pinax/core/management/commands/setup_project.py
@@ -91,7 +91,11 @@ def project_list(self):
def setup_project(self, destination, base, options):
user_project_name = os.path.basename(destination)
-
+
+ if not re.search(r"^\w+$", user_project_name):
+ sys.stderr.write("Error: %r is not a valid app name. Please use only numbers, letters and underscores.\n" % (user_project_name))
+ sys.exit(1)
+
if os.path.exists(destination):
raise CommandError("Destination path already exists [%s]" % destination)
Something went wrong with that request. Please try again.