Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored March 19, 2008
9  django/core/management/commands/startproject.py
@@ -20,8 +20,13 @@ def handle_label(self, project_name, **options):
20 20
         # the parent directory.
21 21
         directory = os.getcwd()
22 22
 
23  
-        if project_name in INVALID_PROJECT_NAMES:
24  
-            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)
  23
+        try:
  24
+            proj_name = __import__(project_name)
  25
+            if proj_name:
  26
+                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)
  27
+        except ImportError:
  28
+            if project_name in INVALID_PROJECT_NAMES:
  29
+                raise CommandError("%r contains an invalid project name. Please try another name." % project_name)
25 30
 
26 31
         copy_helper(self.style, 'project', project_name, directory)
27 32
 

0 notes on commit 6035af8

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