|
|
|
@ -920,7 +920,18 @@ class xmlDoc:
|
|
|
|
|
else:
|
|
|
|
|
self.joinField(xmlOldArea, node)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def insertBeforeSepAreas(self, xmlArea):
|
|
|
|
|
"""Добавляет разделитель областей перед каждой областью"""
|
|
|
|
|
if not self.sepAreas:
|
|
|
|
|
return False
|
|
|
|
|
areaNodes = xpath.Evaluate('descendant::area',xmlArea)
|
|
|
|
|
for areaNode in areaNodes:
|
|
|
|
|
prevNode = areaNode.previousSibling
|
|
|
|
|
if prevNode:
|
|
|
|
|
parentNode = areaNode.parentNode
|
|
|
|
|
parentNode.insertBefore(self.sepAreas.cloneNode(True),
|
|
|
|
|
areaNode)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def joinArea(self, baseNode, xmlNewArea):
|
|
|
|
|
"""Объединяет область c областью Body (xmlNewArea c baseNode)"""
|
|
|
|
@ -1887,9 +1898,9 @@ class profile(_file, _terms):
|
|
|
|
|
|
|
|
|
|
def __getApplyHeadProfile(self ,newFile, oldFile):
|
|
|
|
|
self.nameFileNew = self.absFileName(newFile)
|
|
|
|
|
self.closeNewFile()
|
|
|
|
|
self.FN = self.openNewFile(self.nameFileNew)
|
|
|
|
|
self.newProfile = self.FN.read()
|
|
|
|
|
self.closeNewFile()
|
|
|
|
|
objHeadNew = calcHeader(self.newProfile, False,
|
|
|
|
|
self.getFileType(),objVar=self.objVar)
|
|
|
|
|
if not objHeadNew.headerTerm:
|
|
|
|
@ -2008,16 +2019,22 @@ class profile(_file, _terms):
|
|
|
|
|
Объединение профиля newFile и конф. файла oldFile,
|
|
|
|
|
ListOptTitle - список строк которые добавятся в заголовок
|
|
|
|
|
"""
|
|
|
|
|
# Выполняем условия для блока текста а так-же заменяем переменные
|
|
|
|
|
self.nameFileNew = self.absFileName(newFile)
|
|
|
|
|
if self.getFileType() != "bin":
|
|
|
|
|
self.newProfile = self.applyTermsProfile(self.newProfile,
|
|
|
|
|
newFile)
|
|
|
|
|
self.newProfile = self.applyVarsProfile(self.newProfile)
|
|
|
|
|
|
|
|
|
|
objHeadNew = self.__getApplyHeadProfile(newFile, oldFile)
|
|
|
|
|
if not objHeadNew:
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
self.newProfile = objHeadNew.body
|
|
|
|
|
if objHeadNew.fileType != "bin":
|
|
|
|
|
self.newProfile = self.applyTermsProfile(self.newProfile,
|
|
|
|
|
newFile)
|
|
|
|
|
self.newProfile = self.applyVarsProfile(self.newProfile)
|
|
|
|
|
print "#%s#" %(objHeadNew.body)
|
|
|
|
|
#if objHeadNew.fileType != "bin":
|
|
|
|
|
#self.newProfile = self.applyTermsProfile(self.newProfile,
|
|
|
|
|
#newFile)
|
|
|
|
|
#self.newProfile = self.applyVarsProfile(self.newProfile)
|
|
|
|
|
|
|
|
|
|
# Титл конфигурационного файла
|
|
|
|
|
title = ""
|
|
|
|
@ -2034,6 +2051,41 @@ class profile(_file, _terms):
|
|
|
|
|
print objHeadNew.typeAppend
|
|
|
|
|
|
|
|
|
|
if objHeadNew.fileType:
|
|
|
|
|
# Создаем объект в случае параметра format в заголовке
|
|
|
|
|
print "Заголовок"
|
|
|
|
|
print objHeadNew.typeAppend, objHeadNew.fileType
|
|
|
|
|
if (objHeadNew.typeAppend == "replace" or\
|
|
|
|
|
objHeadNew.typeAppend == "before" or\
|
|
|
|
|
objHeadNew.typeAppend == "after") and\
|
|
|
|
|
(objHeadNew.fileType != "bin" or\
|
|
|
|
|
objHeadNew.fileType != "raw"):
|
|
|
|
|
try:
|
|
|
|
|
exec ("objProfNew=%s(self.newProfile)"%\
|
|
|
|
|
(objHeadNew.fileType))
|
|
|
|
|
except NameError:
|
|
|
|
|
#Создаем объект из self.newObjProt с помощью
|
|
|
|
|
# метаклассов
|
|
|
|
|
if self.newObjProt.has_key(objHeadNew.fileType):
|
|
|
|
|
objProfNewCl = self.createNewClass(\
|
|
|
|
|
objHeadNew.fileType,
|
|
|
|
|
self.newObjProt[objHeadNew.fileType])
|
|
|
|
|
objProfNew = objProfNewCl(self.newProfile)
|
|
|
|
|
else:
|
|
|
|
|
self.setError (\
|
|
|
|
|
_("False join profile for type profile: ")\
|
|
|
|
|
+ objHeadNew.fileType + " : " +\
|
|
|
|
|
newFile)
|
|
|
|
|
return False
|
|
|
|
|
# Объект Документ
|
|
|
|
|
docObj = objProfNew.docObj
|
|
|
|
|
# Удаление комментариев из документа
|
|
|
|
|
docObj.removeComment(docObj.getNodeBody())
|
|
|
|
|
# Добавление необходимых переводов строк
|
|
|
|
|
docObj.insertBRtoBody(docObj.getNodeBody())
|
|
|
|
|
# Добавление необходимых разделителей между областями
|
|
|
|
|
docObj.insertBeforeSepAreas(docObj.getNodeBody())
|
|
|
|
|
# Получение текстового файла из XML документа
|
|
|
|
|
self.newProfile = objProfNew.getConfig().encode("UTF-8")
|
|
|
|
|
# Замена
|
|
|
|
|
if objHeadNew.typeAppend == "replace":
|
|
|
|
|
if objHeadNew.execStr:
|
|
|
|
|