Django

Code

Changeset 2946

Show
Ignore:
Timestamp:
05/19/06 02:40:06 (3 years ago)
Author:
mtredinnick
Message:

Prevent people from using "startapp" to create apps with the same name as their project. Might stop some of the accidents.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management.py

    r2872 r2946  
    666666    project_dir = os.path.normpath(os.path.join(directory, '..')) 
    667667    project_name = os.path.basename(project_dir) 
     668    if app_name == os.path.basename(directory): 
     669        sys.stderr.write(style.ERROR("Error: You cannot create an app with the same name (%r) as your project.\n" % app_name)) 
     670        sys.exit(1) 
    668671    _start_helper('app', app_name, directory, project_name) 
    669672startapp.help_doc = "Creates a Django app directory structure for the given app name in the current directory."