diff --git a/calculate/templates/template_processor.py b/calculate/templates/template_processor.py index 3864071..3bd5ee1 100644 --- a/calculate/templates/template_processor.py +++ b/calculate/templates/template_processor.py @@ -2282,6 +2282,15 @@ class DirectoryProcessor: handler_name, parameters) + if not parameters.run and not parameters.exec: + if not parameters.format: + parameters.set_parameter({'format': 'raw'}) + if not parameters.append: + if parameters.format == "raw": + parameters.set_parameter({'append': 'replace'}) + else: + parameters.set_parameter({'append': 'join'}) + # Выполняем действия, указанные в обработчике. self._execute_template(target_file_path, parameters, FILE, handler_path, diff --git a/tests/templates/format/test_raw.py b/tests/templates/format/test_raw.py index c24b9a3..fd11fd8 100644 --- a/tests/templates/format/test_raw.py +++ b/tests/templates/format/test_raw.py @@ -1,5 +1,4 @@ import pytest -from collections import OrderedDict from calculate.templates.format.raw_format import RawFormat from calculate.templates.template_engine import ParametersContainer diff --git a/tests/templates/testfiles/test_dir_processor_root/templates_35/install/handler_1 b/tests/templates/testfiles/test_dir_processor_root/templates_35/install/handler_1 index bc2259c..58f9dcf 100644 --- a/tests/templates/testfiles/test_dir_processor_root/templates_35/install/handler_1 +++ b/tests/templates/testfiles/test_dir_processor_root/templates_35/install/handler_1 @@ -1,5 +1,5 @@ -{% calculate handler = 'handler_1', append = 'join', path = 'dir_39/', -name = 'file_0', format = 'samba', notify = 'handler_2' %} +{% calculate handler = 'handler_1', path = 'dir_39/', +name = 'file_0', notify = 'handler_2' %} [section 1] parameter 1 = {{ ns.variable_1 }} parameter 2 = {{ ns.variable_2 }}