Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #6789 -- Added some small amount of extra protection for learne…

…rs 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
  • Loading branch information...
commit 6035af82d4c7905c619bccdee030bdfc1721ad0c 1 parent 32933d2
@malcolmt malcolmt authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 django/core/management/commands/startproject.py
View
9 django/core/management/commands/startproject.py
@@ -20,8 +20,13 @@ def handle_label(self, project_name, **options):
# the parent directory.
directory = os.getcwd()
- if project_name in INVALID_PROJECT_NAMES:
- 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)
+ try:
+ 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)

0 comments on commit 6035af8

Please sign in to comment.
Something went wrong with that request. Please try again.