Ticket #3475: invalid_app_names.patch

File invalid_app_names.patch, 1014 bytes (added by frankie@…, 18 years ago)

Against [4485]

  • django/core/management.py

     
    2727
    2828INVALID_PROJECT_NAMES = ('django', 'site', 'test')
    2929
     30INVALID_APPLICATION_NAMES = INVALID_PROJECT_NAMES
     31
    3032# Set up the terminal color scheme.
    3133class dummy: pass
    3234style = dummy()
     
    726728    "Creates a Django app for the given app_name in the given directory."
    727729    # Determine the project_name a bit naively -- by looking at the name of
    728730    # the parent directory.
     731    if app_name in INVALID_APPLICATION_NAMES:
     732        sys.stderr.write(style.ERROR("Error: '%r' conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name.\n" % app_name))
     733        sys.exit(1)
    729734    project_dir = os.path.normpath(os.path.join(directory, '..'))
    730735    project_name = os.path.basename(project_dir)
    731736    if app_name == os.path.basename(directory):
Back to Top