#NEWLINE# def process( self , force = False ) : #NEWLINE# #INDENT# click . echo ( 'Processing {}' . format ( self . migration_name ) ) #NEWLINE# if ( ( self . status == Migration . STATE_NEW ) or force ) : #NEWLINE# #INDENT# self . update_status ( Migration . STATE_PROCESSING ) #NEWLINE# echo ( 'Starting: {}' . format ( self . migration_name ) ) #NEWLINE# try : #NEWLINE# #INDENT# self . run ( ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# echo ( 'Migration {} Failed' . format ( self . migration_name ) ) #NEWLINE# ( typ , value , traceback ) = sys . exc_info ( ) #NEWLINE# echo ( 'Unexpected error: [{}]' . format ( typ ) ) #NEWLINE# echo ( 'Unexpected value: [{}]' . format ( value ) ) #NEWLINE# echo ( 'Unexpected traceback: [{}]' . format ( traceback ) ) #NEWLINE# self . update_status ( Migration . STATE_FAILED ) #NEWLINE# raise #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# echo ( 'Migration {} Successful' . format ( self . migration_name ) ) #NEWLINE# self . update_status ( Migration . STATE_COMPLETED ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . status == Migration . STATE_PROCESSING ) : #NEWLINE# #INDENT# echo ( '{} is currently being processed' . format ( self . migration_name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . status == Migration . STATE_COMPLETED ) : #NEWLINE# #INDENT# echo ( '{} has already been processed' . format ( traceback . migration_name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . status == Migration . STATE_FAILED ) : #NEWLINE# #INDENT# echo ( '{} has already been processed, and failed - best to restart' . format ( self . migration_name ) )