#NEWLINE# def handle_noargs( self , **options ) : #NEWLINE# #INDENT# database = options . get ( 'database' ) #NEWLINE# connection = connections [ database ] #NEWLINE# verbosity = int ( options . get ( 'verbosity' ) ) #NEWLINE# interactive = options . get ( 'interactive' ) #NEWLINE# reset_sequences = options . get ( 'reset_sequences' , True ) #NEWLINE# allow_cascade = options . get ( 'allow_cascade' , False ) #NEWLINE# inhibit_post_syncdb = options . get ( 'inhibit_post_syncdb' , False ) #NEWLINE# self . style = no_style ( ) #NEWLINE# for app_name in settings . INSTALLED_APPS : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# import_module ( '.management' , app_name ) #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# sql_list = sql_flush ( self . style , connection , only_django = True , reset_sequences = reset_sequences , allow_cascade = allow_cascade ) #NEWLINE# if interactive : #NEWLINE# #INDENT# confirm = input ( ( "You have requested a flush of the database.\nThis will IRREVERSIBLY DESTROY all data currently in the %r database,\nand return each table to the state it was in after syncdb.\nAre you sure you want to do this?\n\n    Type 'yes' to continue, or 'no' to cancel: " % connection . settings_dict [ 'NAME' ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# confirm = 'yes' #NEWLINE# #UNINDENT# if ( confirm == 'yes' ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with transaction . atomic ( using = database , savepoint = connection . features . can_rollback_ddl ) : #NEWLINE# #INDENT# cursor = connection . cursor ( ) #NEWLINE# for sql in sql_list : #NEWLINE# #INDENT# cursor . execute ( sql ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# new_msg = ( "Database %s couldn't be flushed. Possible reasons:\n  * The database isn't running or isn't configured correctly.\n  * At least one of the expected database tables doesn't exist.\n  * The SQL was invalid.\nHint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run.\nThe full error: %s" % ( connection . settings_dict [ 'NAME' ] , e ) ) #NEWLINE# six . reraise ( CommandError , CommandError ( new_msg ) , sys . exc_info ( ) [ 2 ] ) #NEWLINE# #UNINDENT# if ( not inhibit_post_syncdb ) : #NEWLINE# #INDENT# self . emit_post_syncdb ( verbosity , interactive , database ) #NEWLINE# #UNINDENT# if options . get ( 'load_initial_data' ) : #NEWLINE# #INDENT# call_command ( 'loaddata' , 'initial_data' , ** options ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . stdout . write ( 'Flush cancelled.\n' )