def execute(self, context): array = None if definitions.is_definition(self.array): def_name = definitions.extract_definition_name(self.array) definition = context.get_definition(def_name) if definition == None: logging.error("Definition " + def_name + " not found") return False array = definition.to_array() else: array = self.array.split(",") for i in array: string = definitions.String(self.loop_variable) string.set_value(i) context.add_definition(string) if self.execute_sub_works(context) == False: context.remove_definition(self.loop_variable) return False context.remove_definition(self.loop_variable)
def execute( self, context ) : array = None if definitions.is_definition( self.array ) : def_name = definitions.extract_definition_name( self.array ) definition = context.get_definition( def_name ) if definition == None : logging.error( "Definition " + def_name + " not found" ) return False array = definition.to_array() else : array = self.array.split( "," ) for i in array : string = definitions.String( self.loop_variable ) string.set_value( i ) context.add_definition( string ) if self.execute_sub_works( context ) == False: context.remove_definition( self.loop_variable ) return False context.remove_definition( self.loop_variable )
def replace_definitions( self, text ) : while True : start = text.find( "${" ) if start == -1 : break end = text.find( "}", start + 2 ) if end == -1 : break; def_text = text[ start:end + 1 ] def_name = definitions.extract_definition_name( def_text ) definition = self.get_definition( def_name ) if definition == None : text = text[ :start ] + text[ end + 1: ] else : text = text[ :start ] + definition.to_string() + text[ end + 1: ] return text
def replace_definitions(self, text): while True: start = text.find("${") if start == -1: break end = text.find("}", start + 2) if end == -1: break def_text = text[start:end + 1] def_name = definitions.extract_definition_name(def_text) definition = self.get_definition(def_name) if definition == None: text = text[:start] + text[end + 1:] else: text = text[:start] + definition.to_string() + text[end + 1:] return text