Ticket #9092: 9092.diff

File 9092.diff, 903 bytes (added by Tom Mortimer-Jones, 16 years ago)
  • django/core/management/base.py

     
    194194    import re
    195195    import shutil
    196196    other = {'project': 'app', 'app': 'project'}[app_or_project]
    197     if not re.search(r'^\w+$', name): # If it's not a valid directory name.
    198         raise CommandError("%r is not a valid %s name. Please use only numbers, letters and underscores." % (name, app_or_project))
     197    if not re.search(r'^[_a-zA-Z][_a-zA-Z0-9]*$', name): # If it's not a valid directory name.
     198        raise CommandError("%r is not a valid %s name. Please use only numbers, letters and underscores. The first character must be a letter or an underscore." % (name, app_or_project))
    199199    top_dir = os.path.join(directory, name)
    200200    try:
    201201        os.mkdir(top_dir)
Back to Top