Fixed #6789 -- Added some small amount of extra protection for learners trying

to pick a name for their project. Thanks, thejaswi_puthraya.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7320 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-03-19 15:10:31 +00:00
parent 32933d27b2
commit 6035af82d4
1 changed files with 7 additions and 2 deletions

View File

@ -20,8 +20,13 @@ class Command(LabelCommand):
# the parent directory. # the parent directory.
directory = os.getcwd() directory = os.getcwd()
if project_name in INVALID_PROJECT_NAMES: try:
raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name) proj_name = __import__(project_name)
if proj_name:
raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
except ImportError:
if project_name in INVALID_PROJECT_NAMES:
raise CommandError("%r contains an invalid project name. Please try another name." % project_name)
copy_helper(self.style, 'project', project_name, directory) copy_helper(self.style, 'project', project_name, directory)