From ea037c3a26322f6b7d608dcba2853b338df9beda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=81?= Date: Fri, 27 Nov 2020 16:23:23 +0300 Subject: [PATCH] removing links was fixed #45 --- calculate/templates/template_processor.py | 19 ++++++++++--------- tests/utils/testfiles/test_output5.png | Bin 0 -> 75 bytes 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 tests/utils/testfiles/test_output5.png diff --git a/calculate/templates/template_processor.py b/calculate/templates/template_processor.py index c6aaf3d..5615473 100644 --- a/calculate/templates/template_processor.py +++ b/calculate/templates/template_processor.py @@ -328,7 +328,7 @@ class TemplateWrapper: elif self.target_is_link: if self.parameters.force: self.remove_original = True - else: + elif not self.parameters.append == "remove": try: link_source = check_directory_link( self.target_path, @@ -355,14 +355,15 @@ class TemplateWrapper: raise TemplateExecutorError("files error: {}". format(str(error))) elif self.target_is_link: - if self.target_type == DIR: - raise TemplateTypeConflict("the target file is a link to a" - " directory while the template" - " is a file") - else: - raise TemplateTypeConflict("the target file is a link to" - " a file while the template" - " is a file") + if not self.parameters.append == "remove": + if self.target_type == DIR: + raise TemplateTypeConflict("the target file is a link" + " to a directory while the" + " template is a file") + else: + raise TemplateTypeConflict("the target file is a link" + " to a file while the" + " template is a file") elif self.target_type == DIR: raise TemplateTypeConflict("the target file is a directory" " while the template is a file") diff --git a/tests/utils/testfiles/test_output5.png b/tests/utils/testfiles/test_output5.png new file mode 100644 index 0000000000000000000000000000000000000000..08eaa7f712708840fa1242d1f1725b40216fb52c GIT binary patch literal 75 zcmeAS@N?(olHy`uVBq!ia0vp^20$#p2qYLPt{#*DQbL|Cjv*Y^lYjhgY;62*&%9TI Xp?jYG#g1U}vmjNTu6{1-oD!M