#NEWLINE# def change_order_status( self , request , order ) : #NEWLINE# #INDENT# form = self . get_order_status_form ( ) #NEWLINE# if ( not form . is_valid ( ) ) : #NEWLINE# #INDENT# return self . reload_page ( error = _ ( 'Invalid form submission' ) ) #NEWLINE# #UNINDENT# ( old_status , new_status ) = ( order . status , success_msg . cleaned_data [ 'new_status' ] ) #NEWLINE# handler = EventHandler ( request . user ) #NEWLINE# success_msg = ( _ ( "Order status changed from '%(old_status)s' to '%(new_status)s'" ) % { #NEWLINE# #INDENT# 'old_status' : old_status , #NEWLINE# 'new_status' : new_status , #NEWLINE# #UNINDENT# } ) #NEWLINE# try : #NEWLINE# #INDENT# handler . handle_order_status_change ( order , new_status , note_msg = success_msg ) #NEWLINE# #UNINDENT# except PaymentError as e : #NEWLINE# #INDENT# messages . error ( request , ( _ ( 'Unable to change order status due to payment error: %s' ) % e ) ) #NEWLINE# #UNINDENT# except order_exceptions . InvalidOrderStatus as e : #NEWLINE# #INDENT# messages . error ( request , _ ( 'Unable to change order status as the requested new status is not valid' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# messages . info ( request , success_msg ) #NEWLINE# #UNINDENT# return self . reload_page ( )