diff --git a/pym/cl_template.py b/pym/cl_template.py index edb05b8..9d4aac9 100644 --- a/pym/cl_template.py +++ b/pym/cl_template.py @@ -25,13 +25,15 @@ import types import random import string import time +import glob # Переопределение exit import cl_overriding from cl_utils import _error, _warning, _toUNICODE, getModeFile, removeDir,\ - typeFile, scanDirectory, convertStrListDict, pathJoin + typeFile, scanDirectory, convertStrListDict, pathJoin,\ + runOsCommand import cl_lang tr = cl_lang.lang() @@ -2268,7 +2270,6 @@ class templateFunction(_error, _shareTemplate, _shareTermsFunction): # Текст функции шаблона functText = "" - def __init__(self, objVar): # Если не определен словарь функций шаблона if not self.templateFunction: @@ -3125,6 +3126,21 @@ os_disk_install not found mount point '\' and '\%s'")%mountPoint) textTemplateTmp[resS.end():] return textTemplateTmp + def funcExec(self, funArgv, resS, localVars, textTemplateTmp): + """Функция шаблона exec(). + + Выполняет первый аргумент, при ошибке результат "" иначе "1" + """ + retCode, outMess = runOsCommand(funArgv) + print outMess + if retCode == 0: + replace = "1" + else: + replace = "" + textTemplateTmp = textTemplateTmp[:resS.start()] + replace +\ + textTemplateTmp[resS.end():] + return textTemplateTmp + def printErrTemplate(self): """Печать ошибки при обработке функций шаблона""" cl_overriding.printERROR(_("error in template %s")%self.nameTemplate)