#NEWLINE# def handle( self , * args , **options ) : #NEWLINE# #INDENT# path = options . get ( 'path' ) #NEWLINE# @ transaction . atomic #NEWLINE# def do_backup( src_path , dest_path ) : #NEWLINE# #INDENT# cursor = connection . cursor ( ) #NEWLINE# cursor . execute ( 'SELECT count(*) from sqlite_master' ) #NEWLINE# try : #NEWLINE# #INDENT# shutil . copy ( src_path , dest_path ) #NEWLINE# #UNINDENT# except IOError : #NEWLINE# #INDENT# raise CommandError ( 'Database backup failed.' ) #NEWLINE# #UNINDENT# #UNINDENT# database_path = get_database_path_from_settings ( ) #NEWLINE# if args : #NEWLINE# #INDENT# do_backup ( database_path , path ) #NEWLINE# self . stdout . write ( ( 'Database %s successfully stored at %s.' % ( database_path , path ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise CommandError ( 'Default database is not SQLite3. Only SQLite3 databasescan currently be backuped.' )