diff --git a/i18n/cl_lib_ru.mo b/i18n/cl_lib_ru.mo index d8cdb4d..189140c 100644 Binary files a/i18n/cl_lib_ru.mo and b/i18n/cl_lib_ru.mo differ diff --git a/pym/cl_template.py b/pym/cl_template.py index 63af339..b2bf9ff 100644 --- a/pym/cl_template.py +++ b/pym/cl_template.py @@ -2571,12 +2571,22 @@ class templateFunction(_error, _shareTemplate, _shareTermsFunction): def funcExists(self, funArgv, resS, localVars, textTemplateTmp): """Функция шаблона exists(), проверяет существование файла, если существует выдает '1' + если второй параметр root, то проверка осуществляется от корня. """ terms = map(lambda x: x.strip(), funArgv.split(",")) - if len(terms) !=1: + if len(terms) > 2: self.printErrTemplate() cl_overriding.exit(1) fileName = terms[0] + flagNotRootFS = True + if len(terms) == 2: + if terms[1] == "root": + flagNotRootFS = False + else: + self.printErrTemplate() + cl_overriding.printERROR(\ + _("Second argument function is not 'root'")) + cl_overriding.exit(1) if fileName[0] == "~": # Получаем директорию пользователя fileName = os.path.join(self.homeDir, @@ -2586,7 +2596,8 @@ class templateFunction(_error, _shareTemplate, _shareTermsFunction): cl_overriding.printERROR(_("wrong path '%s'")%fileName) cl_overriding.exit(1) else: - fileName = pathJoin(self._baseDir, fileName) + if flagNotRootFS: + fileName = pathJoin(self._baseDir, fileName) replace = "" if os.path.exists(fileName): replace = "1"