Django

Code

Changeset 2541

Show
Ignore:
Timestamp:
03/20/06 13:58:37 (3 years ago)
Author:
adrian
Message:

magic-removal: Made 'Would you like to create a superuser' raw_input() more fault-tolerant in django/core/management.py

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/django/core/management.py

    r2537 r2541  
    9191    # Get installed models, so we generate REFERENCES right 
    9292    installed_models = _get_installed_models(_get_table_list()) 
    93      
     93 
    9494    final_output = [] 
    9595    models_output = set(installed_models) 
     
    116116        final_output.append('-- The following references should be added but depend on non-existant tables:') 
    117117        for klass in not_installed_models: 
    118             final_output.extend(['-- ' + sql for sql in  
     118            final_output.extend(['-- ' + sql for sql in 
    119119                _get_sql_for_pending_references(klass, pending_references)]) 
    120120 
     
    485485    from django.contrib.auth.models import User 
    486486    if User in created_models: 
    487         msg = "\nIt looks like you just installed Django's auth system which means you don't have " \ 
     487        msg = "\nYou just installed Django's auth system, which means you don't have " \ 
    488488              "any superusers defined.\nWould you like to create one now? (yes/no): " 
    489489        confirm = raw_input(msg) 
    490         if confirm.lower().startswith('y'): 
    491             createsuperuser() 
     490        while 1: 
     491            if confirm not in ('yes', 'no'): 
     492                confirm = raw_input('Please enter either "yes" or "no": ') 
     493                continue 
     494            if confirm == 'yes': 
     495                createsuperuser() 
     496            break 
    492497 
    493498syncdb.args = ''