|
|
|
@ -31,7 +31,7 @@ from cl_ldap import ldapFun
|
|
|
|
|
# Переопределение exit
|
|
|
|
|
import cl_overriding
|
|
|
|
|
|
|
|
|
|
from cl_utils import _error, _toUNICODE, getModeFile
|
|
|
|
|
from cl_utils import _error, _toUNICODE, getModeFile, removeDir
|
|
|
|
|
|
|
|
|
|
import cl_lang
|
|
|
|
|
tr = cl_lang.lang()
|
|
|
|
@ -1883,36 +1883,31 @@ class _file(_error):
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
def __init__(self):
|
|
|
|
|
# Имя файла старого шаблона
|
|
|
|
|
self.nameFileOld = ""
|
|
|
|
|
# Имя файла конфигурационного файла
|
|
|
|
|
self.nameFileConfig = ""
|
|
|
|
|
# Старый шаблон
|
|
|
|
|
self.oldTemplate = ""
|
|
|
|
|
# Имя файла нового шаблона
|
|
|
|
|
self.nameFileNew = ""
|
|
|
|
|
self.textConfig = ""
|
|
|
|
|
# Имя файла шаблона
|
|
|
|
|
self.nameFileTemplate = ""
|
|
|
|
|
# Новый шаблон
|
|
|
|
|
self.newTemplate = ""
|
|
|
|
|
# Дескриптор файла нового шаблона
|
|
|
|
|
self.FN = False
|
|
|
|
|
# Дескриптор файла старого шаблона
|
|
|
|
|
self.FO = False
|
|
|
|
|
|
|
|
|
|
# Владелец и режим доступа файла шаблона
|
|
|
|
|
self._mode = False
|
|
|
|
|
self._uid = False
|
|
|
|
|
self._gid = False
|
|
|
|
|
|
|
|
|
|
self.openNewFile = self.__openNewFile
|
|
|
|
|
self.absFileName = self.__absFileName
|
|
|
|
|
self.closeNewFile = self.__closeNewFile
|
|
|
|
|
|
|
|
|
|
def getFileType(self, template="New"):
|
|
|
|
|
"""выдать тип файла (text, bin)
|
|
|
|
|
self.textTemplate = ""
|
|
|
|
|
# Дескриптор файла шаблона
|
|
|
|
|
self.F_TEMPL = False
|
|
|
|
|
# Дескриптор файла конфигурационного файла
|
|
|
|
|
self.F_CONF = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getFileType(self):
|
|
|
|
|
"""выдать тип шаблона (text, bin)
|
|
|
|
|
"""
|
|
|
|
|
if self.nameFileNew:
|
|
|
|
|
nameFile = self.nameFileNew
|
|
|
|
|
if template=="Old" and self.nameFileOld:
|
|
|
|
|
nameFile = self.nameFileOld
|
|
|
|
|
sp = subprocess.Popen("file '%s'"%nameFile, stdin=subprocess.PIPE,
|
|
|
|
|
nameFile = self.nameFileTemplate
|
|
|
|
|
if not nameFile:
|
|
|
|
|
print _("ERROR:")
|
|
|
|
|
print _("The name of template is not specified, \
|
|
|
|
|
it is impossible to execute the command") + " 'file name_of_template'"
|
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
|
execStr = "file '%s'"%nameFile
|
|
|
|
|
sp = subprocess.Popen(execStr, stdin=subprocess.PIPE,
|
|
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
|
|
|
|
close_fds=True, shell=True)
|
|
|
|
|
fout, fin, ferr = (sp.stdout, sp.stdin, sp.stderr)
|
|
|
|
@ -1921,6 +1916,11 @@ class _file(_error):
|
|
|
|
|
fout.readlines()
|
|
|
|
|
fout.close()
|
|
|
|
|
retText = ""
|
|
|
|
|
# Ошибка
|
|
|
|
|
if "`" in textLine:
|
|
|
|
|
print _("Can not execute:") + ": %s"%execStr
|
|
|
|
|
print textLine
|
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
|
if textLine:
|
|
|
|
|
listTextLine = textLine.split(":")
|
|
|
|
|
if len(listTextLine) == 2:
|
|
|
|
@ -1934,124 +1934,81 @@ class _file(_error):
|
|
|
|
|
ferr.close()
|
|
|
|
|
return retText
|
|
|
|
|
|
|
|
|
|
def scanDirs(self, templatesDirs):
|
|
|
|
|
"""Сканирует дерево каталогов выдает два списка: директории, файлы"""
|
|
|
|
|
dirs = []
|
|
|
|
|
class dirTempl:
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.baseDir = False
|
|
|
|
|
self.dirs = []
|
|
|
|
|
self.files = []
|
|
|
|
|
self.links = []
|
|
|
|
|
self.sockets = []
|
|
|
|
|
def getFilesDir(dirP, dirname,names):
|
|
|
|
|
for nameFile in names:
|
|
|
|
|
absNameFile = dirname + "/" + nameFile
|
|
|
|
|
if os.path.islink(absNameFile):
|
|
|
|
|
dest = absNameFile
|
|
|
|
|
src = os.readlink(absNameFile)
|
|
|
|
|
dirP.links.append((src,dest))
|
|
|
|
|
elif os.path.isfile(absNameFile):
|
|
|
|
|
dirP.files.append(absNameFile)
|
|
|
|
|
elif os.path.isdir(absNameFile):
|
|
|
|
|
dirP.dirs.append(absNameFile)
|
|
|
|
|
elif stat.S_ISSOCK(os.stat(absNameFile)[stat.ST_MODE]):
|
|
|
|
|
dirP.sockets.append(absNameFile)
|
|
|
|
|
for templateDir in templatesDirs:
|
|
|
|
|
if templateDir:
|
|
|
|
|
dirP = dirTempl()
|
|
|
|
|
dirP.baseDir = templateDir
|
|
|
|
|
dirs.append(dirP)
|
|
|
|
|
os.path.walk(templateDir,getFilesDir, dirP)
|
|
|
|
|
return dirs
|
|
|
|
|
|
|
|
|
|
def __absFileName(self, nameFile):
|
|
|
|
|
"""Вычисление пути к файлу"""
|
|
|
|
|
pathList = nameFile.split("/")
|
|
|
|
|
chortNameFile = pathList.pop()
|
|
|
|
|
absPath = os.path.abspath("/".join(pathList))
|
|
|
|
|
File = absPath + "/" + chortNameFile
|
|
|
|
|
return File
|
|
|
|
|
|
|
|
|
|
def saveOldFile(self):
|
|
|
|
|
def saveConfFile(self):
|
|
|
|
|
"""Записать конфигурацию"""
|
|
|
|
|
if self.FO:
|
|
|
|
|
self.FO.truncate(0)
|
|
|
|
|
self.FO.seek(0)
|
|
|
|
|
if not self.oldTemplate:
|
|
|
|
|
self.oldTemplate = self.newTemplate
|
|
|
|
|
if self.F_CONF:
|
|
|
|
|
self.F_CONF.truncate(0)
|
|
|
|
|
self.F_CONF.seek(0)
|
|
|
|
|
if not self.textConfig:
|
|
|
|
|
self.textConfig = self.textTemplate
|
|
|
|
|
try:
|
|
|
|
|
self.FO.write(self.oldTemplate)
|
|
|
|
|
self.F_CONF.write(self.textConfig)
|
|
|
|
|
except:
|
|
|
|
|
self.setError (_("not open file:" ) + self.nameFileOld)
|
|
|
|
|
self.setError (_("not open file:" ) + self.nameFileConfig)
|
|
|
|
|
return False
|
|
|
|
|
self.FO.flush()
|
|
|
|
|
self.F_CONF.flush()
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def __openNewFile(self, nameFileNew):
|
|
|
|
|
def openTemplFile(self, nameFileTemplate):
|
|
|
|
|
"""Открыть файл шаблона"""
|
|
|
|
|
FN = False
|
|
|
|
|
F_TEMPL = False
|
|
|
|
|
try:
|
|
|
|
|
FN = open (nameFileNew, "r")
|
|
|
|
|
self._mode,self._uid,self._gid = getModeFile(nameFileNew)
|
|
|
|
|
F_TEMPL = open(nameFileTemplate, "r")
|
|
|
|
|
except:
|
|
|
|
|
self.setError (_("not open file:" ) + nameFileNew)
|
|
|
|
|
self.setError (_("not open file:" ) + nameFileTemplate)
|
|
|
|
|
return False
|
|
|
|
|
return FN
|
|
|
|
|
return F_TEMPL
|
|
|
|
|
|
|
|
|
|
def __closeNewFile(self):
|
|
|
|
|
if self.FN:
|
|
|
|
|
self.FN.close()
|
|
|
|
|
self.FN = False
|
|
|
|
|
def closeTemplFile(self):
|
|
|
|
|
if self.F_TEMPL:
|
|
|
|
|
self.F_TEMPL.close()
|
|
|
|
|
self.F_TEMPL = False
|
|
|
|
|
|
|
|
|
|
def __closeOldFile(self):
|
|
|
|
|
if self.FO:
|
|
|
|
|
self.FO.close()
|
|
|
|
|
self.FO = False
|
|
|
|
|
if self.F_CONF:
|
|
|
|
|
self.F_CONF.close()
|
|
|
|
|
self.F_CONF = False
|
|
|
|
|
|
|
|
|
|
def __openOldFile(self, nameFileOld, mode, uid, gid):
|
|
|
|
|
def __openConfFile(self, nameFileConfig):
|
|
|
|
|
"""Октрыть конфигурационный файл"""
|
|
|
|
|
FO = False
|
|
|
|
|
F_CONF = False
|
|
|
|
|
try:
|
|
|
|
|
if os.path.islink(nameFileOld):
|
|
|
|
|
if os.path.islink(nameFileConfig):
|
|
|
|
|
# если ссылка то удаляем её
|
|
|
|
|
os.unlink(nameFileOld)
|
|
|
|
|
FO = open (nameFileOld, "r+")
|
|
|
|
|
os.unlink(nameFileConfig)
|
|
|
|
|
F_CONF = open (nameFileConfig, "r+")
|
|
|
|
|
except:
|
|
|
|
|
try:
|
|
|
|
|
fd = os.open(nameFileOld, os.O_CREAT)
|
|
|
|
|
fd = os.open(nameFileConfig, os.O_CREAT)
|
|
|
|
|
os.close(fd)
|
|
|
|
|
os.chmod(nameFileOld, mode)
|
|
|
|
|
os.chown(nameFileOld,uid,gid)
|
|
|
|
|
FO = open(nameFileOld, "r+")
|
|
|
|
|
F_CONF = open(nameFileConfig, "r+")
|
|
|
|
|
except:
|
|
|
|
|
self.setError (_("not open file:" ) + nameFileOld)
|
|
|
|
|
self.setError (_("not open file:" ) + nameFileConfig)
|
|
|
|
|
return False
|
|
|
|
|
return FO
|
|
|
|
|
return F_CONF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def openFiles(self, nameFileNew, nameFileOld):
|
|
|
|
|
def openFiles(self, nameFileTemplate, nameFileConfig):
|
|
|
|
|
"""Открывает шаблон и конфигурационный файл"""
|
|
|
|
|
self.oldTemplate = ""
|
|
|
|
|
self.newTemplate = ""
|
|
|
|
|
self.textConfig = ""
|
|
|
|
|
self.textTemplate = ""
|
|
|
|
|
self.closeFiles()
|
|
|
|
|
self.FN = False
|
|
|
|
|
self.FO = False
|
|
|
|
|
self.nameFileOld = self.__absFileName(nameFileOld)
|
|
|
|
|
self.nameFileNew = self.__absFileName(nameFileNew)
|
|
|
|
|
self.FN = self.__openNewFile(self.nameFileNew)
|
|
|
|
|
self.FO = self.__openOldFile(self.nameFileOld,
|
|
|
|
|
self._mode, self._uid, self._gid)
|
|
|
|
|
if self.FN and self.FO:
|
|
|
|
|
self.newTemplate = self.FN.read()
|
|
|
|
|
self.oldTemplate = self.FO.read()
|
|
|
|
|
self.F_TEMPL = False
|
|
|
|
|
self.F_CONF = False
|
|
|
|
|
self.nameFileConfig = os.path.abspath(nameFileConfig)
|
|
|
|
|
self.nameFileTemplate = os.path.abspath(nameFileTemplate)
|
|
|
|
|
self.F_TEMPL = self.openTemplFile(self.nameFileTemplate)
|
|
|
|
|
self.F_CONF = self.__openConfFile(self.nameFileConfig)
|
|
|
|
|
if self.F_TEMPL and self.F_CONF:
|
|
|
|
|
self.textTemplate = self.F_TEMPL.read()
|
|
|
|
|
self.textConfig = self.F_CONF.read()
|
|
|
|
|
|
|
|
|
|
def __del__(self):
|
|
|
|
|
self.closeFiles()
|
|
|
|
|
|
|
|
|
|
def closeFiles(self):
|
|
|
|
|
"""Закрытие файлов"""
|
|
|
|
|
self.__closeNewFile()
|
|
|
|
|
self.closeTemplFile()
|
|
|
|
|
self.__closeOldFile()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2212,48 +2169,18 @@ class utfBin:
|
|
|
|
|
resS = reVar.search(textTemplateTmp)
|
|
|
|
|
return textTemplateTmp
|
|
|
|
|
|
|
|
|
|
def getUserDataInLDAP(self, userName):
|
|
|
|
|
"""Получаем домашнюю директорию пользователя из LDAP"""
|
|
|
|
|
if not self.conLdap:
|
|
|
|
|
data = self.getLDAPDataInConfig()
|
|
|
|
|
if not data:
|
|
|
|
|
return ""
|
|
|
|
|
serverName, usersDN, bindDN, bindPW = data
|
|
|
|
|
# Подключаемся к LDAP
|
|
|
|
|
ldapObj = ldapFun(bindDN, bindPW, serverName)
|
|
|
|
|
if self.getError():
|
|
|
|
|
return ""
|
|
|
|
|
self.conLdap = ldapObj.conLdap
|
|
|
|
|
searchScope = ldap.SCOPE_ONELEVEL
|
|
|
|
|
searchFilter = "uid=%s" %(userName)
|
|
|
|
|
retrieveAttributes = ["uidNumber",
|
|
|
|
|
"gidNumber"
|
|
|
|
|
"homeDirectory"]
|
|
|
|
|
resSearch = ldapObj.ldapSearch(usersDN, searchScope,
|
|
|
|
|
searchFilter, retrieveAttributes)
|
|
|
|
|
if resSearch:
|
|
|
|
|
if resSearch[0][0][1].has_key('uidNumber') and\
|
|
|
|
|
resSearch[0][0][1].has_key('gidNumber') and\
|
|
|
|
|
resSearch[0][0][1].has_key('homeDirectory'):
|
|
|
|
|
uid = searchUser[0][0][1]['uidNumber'][0]
|
|
|
|
|
gid = searchUser[0][0][1]['gidNumber'][0]
|
|
|
|
|
homeDir = resSearch[0][0][1]['homeDirectory'][0]
|
|
|
|
|
return uid, gid, homeDir
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class processingTemplates:
|
|
|
|
|
"""Класс для обработки шаблонов"""
|
|
|
|
|
class scanDirectory:
|
|
|
|
|
"""Класс для cканирования директории"""
|
|
|
|
|
|
|
|
|
|
def processingFile(self, path, prefix):
|
|
|
|
|
"""Обработка в случае шаблона файла"""
|
|
|
|
|
"""Обработка в случае файла"""
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def processingDirectory(self, path, prefix):
|
|
|
|
|
"""Обработка в случае директории если возвращаем None то пропуск дир."""
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def scanningTemplates(self, scanDir, skipFile=[], skipDir=[],
|
|
|
|
|
def scanningDirectory(self, scanDir, skipFile=[], skipDir=[],
|
|
|
|
|
prefix=None, flagDir=False):
|
|
|
|
|
"""Сканирование и обработка шаблонов в директории scanDir"""
|
|
|
|
|
ret = True
|
|
|
|
@ -2289,7 +2216,7 @@ class processingTemplates:
|
|
|
|
|
elif retDir is False:
|
|
|
|
|
ret = False
|
|
|
|
|
break
|
|
|
|
|
ret = self.scanningTemplates(absPath, skipFile,
|
|
|
|
|
ret = self.scanningDirectory(absPath, skipFile,
|
|
|
|
|
skipDir, prefix, True)
|
|
|
|
|
if ret is False:
|
|
|
|
|
break
|
|
|
|
@ -3080,35 +3007,7 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
self.setError (_("Empty oct value"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def removeDir(self, rmDir):
|
|
|
|
|
"""Рекурсивное удаление директории
|
|
|
|
|
|
|
|
|
|
входной параметр директория
|
|
|
|
|
Обязательно должен быть определен метод self.printERROR
|
|
|
|
|
"""
|
|
|
|
|
if not os.path.exists(rmDir):
|
|
|
|
|
self.printERROR(_("Not found remove dir %s") %rmDir)
|
|
|
|
|
return False
|
|
|
|
|
fileObj = _file()
|
|
|
|
|
# Сканируем директорию
|
|
|
|
|
scanObjs = fileObj.scanDirs([rmDir])
|
|
|
|
|
for socketRm in scanObjs[0].sockets:
|
|
|
|
|
# Удаляем сокеты
|
|
|
|
|
if os.path.exists(socketRm):
|
|
|
|
|
os.remove(socketRm)
|
|
|
|
|
for linkRm in scanObjs[0].links:
|
|
|
|
|
# Удаляем ссылки
|
|
|
|
|
os.unlink(linkRm[1])
|
|
|
|
|
for fileRm in scanObjs[0].files:
|
|
|
|
|
# Удаляем файлы
|
|
|
|
|
os.remove(fileRm)
|
|
|
|
|
scanObjs[0].dirs.sort(lambda x, y: cmp(len(y), len(x)))
|
|
|
|
|
for dirRm in scanObjs[0].dirs:
|
|
|
|
|
# Удаляем директории
|
|
|
|
|
os.rmdir(dirRm)
|
|
|
|
|
if rmDir:
|
|
|
|
|
os.rmdir(rmDir)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def createDir(self, dirName, mode=False, uid=False, gid=False):
|
|
|
|
|
"""Создает директорию"""
|
|
|
|
@ -3290,73 +3189,6 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
"""
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def scanDirs(self, templatesDirs, objVar=False):
|
|
|
|
|
"""Измененный метод сканирования директорий"""
|
|
|
|
|
dirs = []
|
|
|
|
|
class dirTempl:
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.baseDir = False
|
|
|
|
|
self.dirs = []
|
|
|
|
|
self.files = []
|
|
|
|
|
self.links = []
|
|
|
|
|
self.sockets = []
|
|
|
|
|
flagError = False
|
|
|
|
|
blockDirs = []
|
|
|
|
|
def getFilesDir(dirP, dirname, names):
|
|
|
|
|
for nameFile in names:
|
|
|
|
|
absNameFile = dirname + "/" + nameFile
|
|
|
|
|
findBlock = False
|
|
|
|
|
for blDir in blockDirs:
|
|
|
|
|
st,mid,end = absNameFile.partition(blDir)
|
|
|
|
|
if (not st) and mid and end:
|
|
|
|
|
findBlock = True
|
|
|
|
|
break
|
|
|
|
|
if not findBlock:
|
|
|
|
|
if os.path.islink(absNameFile):
|
|
|
|
|
dest = absNameFile
|
|
|
|
|
src = os.readlink(absNameFile)
|
|
|
|
|
dirP.links.append((src,dest))
|
|
|
|
|
elif os.path.isfile(absNameFile):
|
|
|
|
|
# Добавляем файлы кроме описаний директорий
|
|
|
|
|
if self.templDirNameFile != nameFile:
|
|
|
|
|
dirP.files.append(absNameFile)
|
|
|
|
|
elif os.path.isdir(absNameFile):
|
|
|
|
|
# Обработка условий в названии директории
|
|
|
|
|
if self.getNeedTemplate(absNameFile):
|
|
|
|
|
if self.getError():
|
|
|
|
|
blockDirs.append(absNameFile)
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
dirP.dirs.append(absNameFile)
|
|
|
|
|
else:
|
|
|
|
|
if self.getError():
|
|
|
|
|
blockDirs.append(absNameFile)
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
blockDirs.append(absNameFile)
|
|
|
|
|
elif stat.S_ISSOCK(os.stat(absNameFile)[stat.ST_MODE]):
|
|
|
|
|
dirP.sockets.append(absNameFile)
|
|
|
|
|
for templateDir in templatesDirs:
|
|
|
|
|
if templateDir:
|
|
|
|
|
# Обработка условий в названии директории
|
|
|
|
|
if self.getNeedTemplate(templateDir):
|
|
|
|
|
if self.getError():
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
dirP = dirTempl()
|
|
|
|
|
dirP.baseDir = templateDir
|
|
|
|
|
dirs.append(dirP)
|
|
|
|
|
os.path.walk(templateDir, getFilesDir, dirP)
|
|
|
|
|
else:
|
|
|
|
|
if self.getError():
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
if flagError:
|
|
|
|
|
return []
|
|
|
|
|
return dirs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def applyTemplates(self):
|
|
|
|
|
"""Применяет шаблоны к конфигурационным файлам"""
|
|
|
|
|
|
|
|
|
@ -3409,7 +3241,7 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
# Если директория существует
|
|
|
|
|
tmpDirsTemplates.append(dirTempl)
|
|
|
|
|
dirsTemplates = tmpDirsTemplates
|
|
|
|
|
scanObj = processingTemplates()
|
|
|
|
|
scanObj = scanDirectory()
|
|
|
|
|
scanObj.processingFile = lambda x,y: createDictTemplates(x, y,\
|
|
|
|
|
self.dictTemplates)
|
|
|
|
|
# Считаем количество шаблонов
|
|
|
|
@ -3418,7 +3250,7 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
self.setError(_("No such template directory") +\
|
|
|
|
|
": %s" %dirTemplate)
|
|
|
|
|
return (self.createdDirs, self.filesApply)
|
|
|
|
|
scanObj.scanningTemplates(dirTemplate)
|
|
|
|
|
scanObj.scanningDirectory(dirTemplate)
|
|
|
|
|
self.numberAllTemplates(self.allTemplates)
|
|
|
|
|
# Обрабатываем шаблоны
|
|
|
|
|
for dirTemplate in dirsTemplates:
|
|
|
|
@ -3549,76 +3381,6 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
return None
|
|
|
|
|
return pathDir, objHeadDir
|
|
|
|
|
|
|
|
|
|
def __getGenHeadDir(self, newDir, templateDirFile, changeDirs):
|
|
|
|
|
"""Определяет название создаваемой директории"""
|
|
|
|
|
|
|
|
|
|
def function(text):
|
|
|
|
|
"""Функция обработки функций в заголовке"""
|
|
|
|
|
return self.applyFuncTemplate(text, newDir, templateDirFile)
|
|
|
|
|
|
|
|
|
|
newDirMv = newDir
|
|
|
|
|
findChangeDir = False
|
|
|
|
|
#Меняем путь к директории
|
|
|
|
|
listD = changeDirs.items()
|
|
|
|
|
listD.reverse()
|
|
|
|
|
for dirChangeIn, dirChangeOut in listD:
|
|
|
|
|
st,mid,end = templateDirFile.partition(dirChangeIn)
|
|
|
|
|
if (not st) and mid:
|
|
|
|
|
findChangeDir = True
|
|
|
|
|
break
|
|
|
|
|
if findChangeDir:
|
|
|
|
|
pathRel = dirChangeOut
|
|
|
|
|
lenPathRel = len(pathRel.split("/"))
|
|
|
|
|
lenNewDir = len(newDir.split("/"))
|
|
|
|
|
lenEndDir = lenNewDir - lenPathRel
|
|
|
|
|
tmpDir = newDir
|
|
|
|
|
namesDirs = []
|
|
|
|
|
for i in range(lenEndDir):
|
|
|
|
|
namesDirs.append(os.path.split(tmpDir)[1])
|
|
|
|
|
tmpDir = os.path.split(tmpDir)[0]
|
|
|
|
|
namesDirs.reverse()
|
|
|
|
|
nameDir = "/".join(namesDirs)
|
|
|
|
|
newDirMv = os.path.join(pathRel, nameDir)
|
|
|
|
|
applyDir = newDirMv
|
|
|
|
|
if not os.path.exists(templateDirFile):
|
|
|
|
|
return (applyDir, True)
|
|
|
|
|
try:
|
|
|
|
|
FD = open(templateDirFile)
|
|
|
|
|
textTemplate = FD.read()
|
|
|
|
|
FD.close()
|
|
|
|
|
except:
|
|
|
|
|
self.setError(_("Error open template: " ) +\
|
|
|
|
|
templateDirFile)
|
|
|
|
|
return (applyDir, False)
|
|
|
|
|
objHead = dirHeader(textTemplate, self.objVar,function)
|
|
|
|
|
if not objHead.headerCorrect:
|
|
|
|
|
self.setError(_("Incorrect template: " ) +\
|
|
|
|
|
templateDirFile)
|
|
|
|
|
self.setError(objHead.errorMessage)
|
|
|
|
|
return (applyDir, False)
|
|
|
|
|
if not objHead.headerTerm:
|
|
|
|
|
if objHead.getError():
|
|
|
|
|
self.setError(_("Incorrect template: " ) +\
|
|
|
|
|
templateDirFile)
|
|
|
|
|
return (applyDir, False)
|
|
|
|
|
# Изменяем название директории
|
|
|
|
|
if objHead.params.has_key("name"):
|
|
|
|
|
nameDir = objHead.params['name']
|
|
|
|
|
if "/" in nameDir or nameDir == ".." or nameDir == ".":
|
|
|
|
|
self.setError (_("False value 'name' in template: " ) +\
|
|
|
|
|
templateDirFile)
|
|
|
|
|
return (applyDir, False)
|
|
|
|
|
if not findChangeDir:
|
|
|
|
|
pathRel = os.path.split(os.path.abspath(newDirMv))[0]
|
|
|
|
|
# Новый путь к оригинальному файлу
|
|
|
|
|
newDirMv = os.path.join(pathRel, nameDir)
|
|
|
|
|
applyDir = newDirMv
|
|
|
|
|
# При удаленнии директории
|
|
|
|
|
if objHead.typeAppend == "remove":
|
|
|
|
|
return (applyDir, False)
|
|
|
|
|
return (applyDir, objHead)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __getApplyHeadDir(self, newDir, templateDirFile, optDir):
|
|
|
|
|
"""Применяет шаблон к директории (права, владелец, и.т. д)"""
|
|
|
|
|
|
|
|
|
@ -3699,7 +3461,7 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
if os.path.isdir(applyDir):
|
|
|
|
|
# удаляем директорию
|
|
|
|
|
try:
|
|
|
|
|
self.removeDir(applyDir)
|
|
|
|
|
removeDir(applyDir)
|
|
|
|
|
except:
|
|
|
|
|
self.setError(_("Can not delete dir: " ) +\
|
|
|
|
|
applyDir)
|
|
|
|
@ -3768,11 +3530,11 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
# Файлы в системе к которым были применены шаблоны
|
|
|
|
|
applyFiles = [oldFile]
|
|
|
|
|
if copyFile:
|
|
|
|
|
self.nameFileNew = self.absFileName(newFile)
|
|
|
|
|
self.FN = self.openNewFile(self.nameFileNew)
|
|
|
|
|
self.newTemplate = self.FN.read()
|
|
|
|
|
self.closeNewFile()
|
|
|
|
|
objHeadNew = fileHeader(self.newTemplate, False,
|
|
|
|
|
self.nameFileTemplate = os.path.abspath(newFile)
|
|
|
|
|
self.F_TEMPL = self.openTemplFile(self.nameFileTemplate)
|
|
|
|
|
self.textTemplate = self.F_TEMPL.read()
|
|
|
|
|
self.closeTemplFile()
|
|
|
|
|
objHeadNew = fileHeader(self.textTemplate, False,
|
|
|
|
|
self.getFileType(),objVar=self.objVar,
|
|
|
|
|
function=function)
|
|
|
|
|
if not objHeadNew.headerCorrect:
|
|
|
|
@ -3879,19 +3641,20 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
templateFile = objHeadNew.params['link']
|
|
|
|
|
foundTemplateFile = os.path.exists(templateFile)
|
|
|
|
|
if foundTemplateFile:
|
|
|
|
|
FO = self.openNewFile(templateFile)
|
|
|
|
|
buff = FO.read()
|
|
|
|
|
FO.close()
|
|
|
|
|
F_CONF = self.openTemplFile(templateFile)
|
|
|
|
|
buff = F_CONF.read()
|
|
|
|
|
F_CONF.close()
|
|
|
|
|
fMode, fUid, fGid = getModeFile(templateFile)
|
|
|
|
|
if os.path.exists(pathOldFile):
|
|
|
|
|
os.remove(pathOldFile)
|
|
|
|
|
if foundTemplateFile:
|
|
|
|
|
fd = os.open(pathOldFile, os.O_CREAT)
|
|
|
|
|
os.close(fd)
|
|
|
|
|
os.chmod(pathOldFile, self._mode)
|
|
|
|
|
os.chown(pathOldFile, self._uid, self._gid)
|
|
|
|
|
FON = open (pathOldFile, "r+")
|
|
|
|
|
FON.write(buff)
|
|
|
|
|
FON.close()
|
|
|
|
|
os.chmod(pathOldFile, fMode)
|
|
|
|
|
os.chown(pathOldFile, fUid, fGid)
|
|
|
|
|
F_CONFN = open(pathOldFile, "r+")
|
|
|
|
|
F_CONFN.write(buff)
|
|
|
|
|
F_CONFN.close()
|
|
|
|
|
|
|
|
|
|
# Если символическая ссылка
|
|
|
|
|
if objHeadNew.params.has_key("symbolic"):
|
|
|
|
@ -3939,11 +3702,8 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
return (applyFiles, False)
|
|
|
|
|
|
|
|
|
|
if not os.path.exists(pathOldFile):
|
|
|
|
|
FO = self.openNewFile(newFile)
|
|
|
|
|
FO.close()
|
|
|
|
|
fd = os.open(pathOldFile, os.O_CREAT)
|
|
|
|
|
os.close(fd)
|
|
|
|
|
os.chmod(pathOldFile, self._mode)
|
|
|
|
|
os.chown(pathOldFile, uid, gid)
|
|
|
|
|
else:
|
|
|
|
|
self.setError (_("False value 'chown' in template: " ) +\
|
|
|
|
@ -4009,7 +3769,7 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
def fileIsUtf(self, fileName):
|
|
|
|
|
"""Проверяет файл на кодировку UTF-8"""
|
|
|
|
|
if os.path.exists(fileName):
|
|
|
|
|
FD = open(self.absFileName(fileName))
|
|
|
|
|
FD = open(os.path.abspath(fileName))
|
|
|
|
|
newTemplate = FD.read()
|
|
|
|
|
FD.close()
|
|
|
|
|
try:
|
|
|
|
@ -4027,21 +3787,21 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
optFile = опции для шаблона
|
|
|
|
|
"""
|
|
|
|
|
# Выполняем условия для блока текста а так-же заменяем переменные
|
|
|
|
|
self.nameFileNew = self.absFileName(newFile)
|
|
|
|
|
self.FN = self.openNewFile(self.nameFileNew)
|
|
|
|
|
self.newTemplate = self.FN.read()
|
|
|
|
|
self.closeNewFile()
|
|
|
|
|
self.nameFileTemplate = os.path.abspath(newFile)
|
|
|
|
|
self.F_TEMPL = self.openTemplFile(self.nameFileTemplate)
|
|
|
|
|
self.textTemplate = self.F_TEMPL.read()
|
|
|
|
|
self.closeTemplFile()
|
|
|
|
|
copyFile = True
|
|
|
|
|
if self.getFileType() != "bin":
|
|
|
|
|
# Вычисляем условные блоки
|
|
|
|
|
self.newTemplate = self.applyTermsTemplate(self.newTemplate,
|
|
|
|
|
self.textTemplate = self.applyTermsTemplate(self.textTemplate,
|
|
|
|
|
newFile, oldFile)
|
|
|
|
|
#print "|%s|" %(self.newTemplate)
|
|
|
|
|
#print "|%s|" %(self.textTemplate)
|
|
|
|
|
# Заменяем переменные на их значения
|
|
|
|
|
self.newTemplate = self.applyVarsTemplate(self.newTemplate,
|
|
|
|
|
self.textTemplate = self.applyVarsTemplate(self.textTemplate,
|
|
|
|
|
newFile)
|
|
|
|
|
# Вычисляем функции
|
|
|
|
|
self.newTemplate = self.applyFuncTemplate(self.newTemplate,
|
|
|
|
|
self.textTemplate = self.applyFuncTemplate(self.textTemplate,
|
|
|
|
|
newFile, oldFile)
|
|
|
|
|
copyFile = False
|
|
|
|
|
filesApply, objHeadNew = self.__getApplyHeadTemplate(newFile, oldFile,
|
|
|
|
@ -4062,11 +3822,11 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
# проверяем кодировку оригинального файла
|
|
|
|
|
if not self.fileIsUtf(oldFile):
|
|
|
|
|
flagNotUtf8Old = True
|
|
|
|
|
self.newTemplate = objHeadNew.body
|
|
|
|
|
self.textTemplate = objHeadNew.body
|
|
|
|
|
#if objHeadNew.fileType != "bin":
|
|
|
|
|
#self.newTemplate = self.applyTermsTemplate(self.newTemplate,
|
|
|
|
|
#self.textTemplate = self.applyTermsTemplate(self.textTemplate,
|
|
|
|
|
#newFile)
|
|
|
|
|
#self.newTemplate = self.applyVarsTemplate(self.newTemplate)
|
|
|
|
|
#self.textTemplate = self.applyVarsTemplate(self.textTemplate)
|
|
|
|
|
|
|
|
|
|
# Титл конфигурационного файла
|
|
|
|
|
title = ""
|
|
|
|
@ -4077,9 +3837,9 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
|
|
|
|
|
objHeadOld = False
|
|
|
|
|
if objHeadNew.comment:
|
|
|
|
|
objHeadOld = fileHeader(self.oldTemplate, objHeadNew.comment)
|
|
|
|
|
objHeadOld = fileHeader(self.textConfig, objHeadNew.comment)
|
|
|
|
|
# Тестирование
|
|
|
|
|
#print self.nameFileOld
|
|
|
|
|
#print self.nameFileConfig
|
|
|
|
|
#print objHeadNew.typeAppend
|
|
|
|
|
if objHeadNew.fileType:
|
|
|
|
|
# Создаем объект в случае параметра format в заголовке
|
|
|
|
@ -4091,10 +3851,10 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
# Преобразовываем бинарные файлы
|
|
|
|
|
if flagNotUtf8New:
|
|
|
|
|
objTxtCoder = utfBin()
|
|
|
|
|
self.newTemplate = objTxtCoder.encode(self.newTemplate)
|
|
|
|
|
self.textTemplate = objTxtCoder.encode(self.textTemplate)
|
|
|
|
|
# создаем объект формата шаблона
|
|
|
|
|
objTemplNew = self.getFormatObj(objHeadNew.fileType,
|
|
|
|
|
self.newTemplate)
|
|
|
|
|
self.textTemplate)
|
|
|
|
|
if not objTemplNew:
|
|
|
|
|
self.setError (\
|
|
|
|
|
_("Incorrect header parmeter format=%s in template")\
|
|
|
|
@ -4118,10 +3878,10 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
if 'postXML' in dir(objTemplNew):
|
|
|
|
|
objTemplNew.postXML()
|
|
|
|
|
# Получение текстового файла из XML документа
|
|
|
|
|
self.newTemplate = objTemplNew.getConfig().encode("UTF-8")
|
|
|
|
|
self.textTemplate = objTemplNew.getConfig().encode("UTF-8")
|
|
|
|
|
# Если не UTF-8 производим преобразование
|
|
|
|
|
if flagNotUtf8New:
|
|
|
|
|
self.newTemplate = objTxtCoder.decode(self.newTemplate)
|
|
|
|
|
self.textTemplate = objTxtCoder.decode(self.textTemplate)
|
|
|
|
|
# Титл для объединения
|
|
|
|
|
if ListOptTitle:
|
|
|
|
|
title = self.getTitle(objTemplNew._comment,
|
|
|
|
@ -4130,16 +3890,16 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
# Замена
|
|
|
|
|
if objHeadNew.typeAppend == "replace":
|
|
|
|
|
if "xml_" in objHeadNew.fileType:
|
|
|
|
|
data = self.newTemplate.split("\n")
|
|
|
|
|
data = self.textTemplate.split("\n")
|
|
|
|
|
data.insert(1,title)
|
|
|
|
|
self.oldTemplate = "\n".join(data)
|
|
|
|
|
self.textConfig = "\n".join(data)
|
|
|
|
|
else:
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
self.oldTemplate = objHeadNew.execStr+title+\
|
|
|
|
|
self.newTemplate
|
|
|
|
|
self.textConfig = objHeadNew.execStr+title+\
|
|
|
|
|
self.textTemplate
|
|
|
|
|
else:
|
|
|
|
|
self.oldTemplate = title + self.newTemplate
|
|
|
|
|
self.saveOldFile()
|
|
|
|
|
self.textConfig = title + self.textTemplate
|
|
|
|
|
self.saveConfFile()
|
|
|
|
|
return filesApply
|
|
|
|
|
# Впереди
|
|
|
|
|
elif objHeadNew.typeAppend == "before":
|
|
|
|
@ -4148,20 +3908,20 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
_("False option append=before in template %s") %newFile)
|
|
|
|
|
return False
|
|
|
|
|
if objHeadOld and objHeadOld.body:
|
|
|
|
|
self.oldTemplate = objHeadOld.body
|
|
|
|
|
if self.newTemplate[-1] == "\n":
|
|
|
|
|
tmpTemplate = self.newTemplate + self.oldTemplate
|
|
|
|
|
self.textConfig = objHeadOld.body
|
|
|
|
|
if self.textTemplate[-1] == "\n":
|
|
|
|
|
tmpTemplate = self.textTemplate + self.textConfig
|
|
|
|
|
else:
|
|
|
|
|
tmpTemplate = self.newTemplate + "\n" + self.oldTemplate
|
|
|
|
|
tmpTemplate = self.textTemplate + "\n" + self.textConfig
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
self.oldTemplate = objHeadNew.execStr + title + tmpTemplate
|
|
|
|
|
self.textConfig = objHeadNew.execStr + title + tmpTemplate
|
|
|
|
|
elif objHeadOld.execStr:
|
|
|
|
|
self.oldTemplate = objHeadOld.execStr + title + tmpTemplate
|
|
|
|
|
self.textConfig = objHeadOld.execStr + title + tmpTemplate
|
|
|
|
|
else:
|
|
|
|
|
self.oldTemplate = title + tmpTemplate
|
|
|
|
|
self.textConfig = title + tmpTemplate
|
|
|
|
|
|
|
|
|
|
#print self.oldTemplate
|
|
|
|
|
self.saveOldFile()
|
|
|
|
|
#print self.textConfig
|
|
|
|
|
self.saveConfFile()
|
|
|
|
|
return filesApply
|
|
|
|
|
# Cзади
|
|
|
|
|
elif objHeadNew.typeAppend == "after":
|
|
|
|
@ -4170,27 +3930,27 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
_("False option append=after in template %s") %newFile)
|
|
|
|
|
return False
|
|
|
|
|
if objHeadOld and objHeadOld.body:
|
|
|
|
|
self.oldTemplate = objHeadOld.body
|
|
|
|
|
if self.newTemplate[-1] == "\n":
|
|
|
|
|
tmpTemplate = self.oldTemplate + self.newTemplate
|
|
|
|
|
self.textConfig = objHeadOld.body
|
|
|
|
|
if self.textTemplate[-1] == "\n":
|
|
|
|
|
tmpTemplate = self.textConfig + self.textTemplate
|
|
|
|
|
else:
|
|
|
|
|
tmpTemplate = self.oldTemplate + "\n" + self.newTemplate
|
|
|
|
|
tmpTemplate = self.textConfig + "\n" + self.textTemplate
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
self.oldTemplate = objHeadNew.execStr + title + tmpTemplate
|
|
|
|
|
self.textConfig = objHeadNew.execStr + title + tmpTemplate
|
|
|
|
|
elif objHeadOld.execStr:
|
|
|
|
|
self.oldTemplate = objHeadOld.execStr + title + tmpTemplate
|
|
|
|
|
self.textConfig = objHeadOld.execStr + title + tmpTemplate
|
|
|
|
|
else:
|
|
|
|
|
self.oldTemplate = title + tmpTemplate
|
|
|
|
|
self.saveOldFile()
|
|
|
|
|
self.textConfig = title + tmpTemplate
|
|
|
|
|
self.saveConfFile()
|
|
|
|
|
return filesApply
|
|
|
|
|
# Объединение
|
|
|
|
|
elif objHeadNew.typeAppend == "join":
|
|
|
|
|
if flagNotUtf8New:
|
|
|
|
|
objTxtCoder = utfBin()
|
|
|
|
|
self.newTemplate = objTxtCoder.encode(self.newTemplate)
|
|
|
|
|
self.textTemplate = objTxtCoder.encode(self.textTemplate)
|
|
|
|
|
# создаем объект формата шаблона
|
|
|
|
|
objTemplNew = self.getFormatObj(objHeadNew.fileType,
|
|
|
|
|
self.newTemplate)
|
|
|
|
|
self.textTemplate)
|
|
|
|
|
if not objTemplNew:
|
|
|
|
|
self.setError (\
|
|
|
|
|
_("Incorrect header parmeter format=%s in template")\
|
|
|
|
@ -4210,29 +3970,29 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
|
|
|
|
|
# В случае пустого конфигурационного файла
|
|
|
|
|
reNoClean = re.compile("[^\s]",re.M)
|
|
|
|
|
if not self.oldTemplate or\
|
|
|
|
|
not reNoClean.search(self.oldTemplate):
|
|
|
|
|
self.oldTemplate = ""
|
|
|
|
|
if not self.textConfig or\
|
|
|
|
|
not reNoClean.search(self.textConfig):
|
|
|
|
|
self.textConfig = ""
|
|
|
|
|
#if objHeadNew.execStr:
|
|
|
|
|
#self.oldTemplate = objHeadNew.execStr + \
|
|
|
|
|
#self.textConfig = objHeadNew.execStr + \
|
|
|
|
|
#title + objTemplNew.getConfig().encode("UTF-8")
|
|
|
|
|
#else:
|
|
|
|
|
#self.oldTemplate = title +\
|
|
|
|
|
#self.textConfig = title +\
|
|
|
|
|
#objTemplNew.getConfig().encode("UTF-8")
|
|
|
|
|
#self.saveOldFile()
|
|
|
|
|
#self.saveConfFile()
|
|
|
|
|
#return True
|
|
|
|
|
|
|
|
|
|
objHeadOld = fileHeader(self.oldTemplate, objTemplNew._comment)
|
|
|
|
|
objHeadOld = fileHeader(self.textConfig, objTemplNew._comment)
|
|
|
|
|
if objHeadOld.body:
|
|
|
|
|
self.oldTemplate = objHeadOld.body
|
|
|
|
|
self.textConfig = objHeadOld.body
|
|
|
|
|
else:
|
|
|
|
|
self.oldTemplate = ""
|
|
|
|
|
self.textConfig = ""
|
|
|
|
|
if flagNotUtf8Old:
|
|
|
|
|
objTxtCoder = utfBin()
|
|
|
|
|
self.oldTemplate = objTxtCoder.encode(self.oldTemplate)
|
|
|
|
|
self.textConfig = objTxtCoder.encode(self.textConfig)
|
|
|
|
|
# создаем объект формата шаблона для конфигурационного файла
|
|
|
|
|
objTemplOld = self.getFormatObj(objHeadNew.fileType,
|
|
|
|
|
self.oldTemplate)
|
|
|
|
|
self.textConfig)
|
|
|
|
|
if not objTemplOld:
|
|
|
|
|
self.setError (_("Error in template %s") %oldFile)
|
|
|
|
|
return False
|
|
|
|
@ -4255,22 +4015,22 @@ class template(_file, _terms, xmlShare, templateFormat, _shareTemplate):
|
|
|
|
|
data = \
|
|
|
|
|
objTemplOld.getConfig().encode("UTF-8").split("\n")
|
|
|
|
|
data.insert(1,title)
|
|
|
|
|
self.oldTemplate = "\n".join(data)
|
|
|
|
|
self.textConfig = "\n".join(data)
|
|
|
|
|
else:
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|
self.oldTemplate = objHeadNew.execStr + title +\
|
|
|
|
|
self.textConfig = objHeadNew.execStr + title +\
|
|
|
|
|
objTemplOld.getConfig().encode("UTF-8")
|
|
|
|
|
elif objHeadOld.execStr:
|
|
|
|
|
self.oldTemplate = objHeadOld.execStr + title +\
|
|
|
|
|
self.textConfig = objHeadOld.execStr + title +\
|
|
|
|
|
objTemplOld.getConfig().encode("UTF-8")
|
|
|
|
|
else:
|
|
|
|
|
self.oldTemplate = title +\
|
|
|
|
|
self.textConfig = title +\
|
|
|
|
|
objTemplOld.getConfig().encode("UTF-8")
|
|
|
|
|
# Декодируем если кодировка не UTF-8
|
|
|
|
|
if flagNotUtf8New or flagNotUtf8Old:
|
|
|
|
|
self.newTemplate = objTxtCoder.decode(self.newTemplate)
|
|
|
|
|
self.oldTemplate = objTxtCoder.decode(self.oldTemplate)
|
|
|
|
|
self.saveOldFile()
|
|
|
|
|
self.textTemplate = objTxtCoder.decode(self.textTemplate)
|
|
|
|
|
self.textConfig = objTxtCoder.decode(self.textConfig)
|
|
|
|
|
self.saveConfFile()
|
|
|
|
|
return filesApply
|
|
|
|
|
else:
|
|
|
|
|
self.setError (_("False (type append) template: " ) +\
|
|
|
|
|