Custom func

master 3.7.3.9
root 1 year ago
parent ade7f7f5aa
commit 5e25b585bc

@ -31,6 +31,7 @@ import glob
import hashlib
import codecs
import uuid
import subprocess
from fnmatch import fnmatch
from math import sqrt
from itertools import *
@ -3669,7 +3670,19 @@ class templateFunction(_error, _warning, _shareTemplate, _shareTermsFunction,
mark = textTemplateTmp[resS.start():resS.end()]
self.functText = mark[self._deltVarStart:-self._deltVarEnd]
funcName, spl, funcEnd = self.functText.partition("(")
if funcName in self.namesTemplateFunction:
tempDirs = [x.split('profiles')[0] for x in self.objVar.Get('main.cl_template_path')]
customFunc = [dirPath for dirPath in tempDirs
if os.path.exists(pathJoin(dirPath, 'scripts'))
and funcName in os.listdir(pathJoin(dirPath, 'scripts'))]
if customFunc:
primeTemp = customFunc[-1]
funArgv = funcEnd.rpartition(")")[0]
textTemplateTmp = subprocess.check_output([pathJoin(primeTemp, 'scripts', funcName), funArgv], encoding='UTF-8')
if textTemplateTmp is not None:
resS = funcSearch(textTemplateTmp)
else:
resS = None
elif funcName in self.namesTemplateFunction:
# аргументы функции - '(' аргументы ')'
funArgv = funcEnd.rpartition(")")[0]
# вызов функции шаблона

Loading…
Cancel
Save