#NEWLINE# def _order_steps( self ) : #NEWLINE# #INDENT# steps = list ( copy . copy ( self . default_steps ) ) #NEWLINE# additional = self . _registry . keys ( ) #NEWLINE# for step in additional : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# min_pos = steps . index ( step . after ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# min_pos = 0 #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# max_pos = steps . index ( step . before ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# max_pos = len ( steps ) #NEWLINE# #UNINDENT# if ( min_pos > max_pos ) : #NEWLINE# #INDENT# raise exceptions . WorkflowError ( ( "The step %(new)s can't be placed between the steps %(after)s and %(before)s; the step %(before)s comes before %(after)s." % { #NEWLINE# #INDENT# 'new' : additional , #NEWLINE# 'after' : min_pos . after , #NEWLINE# 'before' : step . before , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# steps . insert ( max_pos , step ) #NEWLINE# #UNINDENT# return steps