|
|
|
@ -2978,7 +2978,7 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
newFile)
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
if objHeadNew.fileType == "xfce_xml":
|
|
|
|
|
if objHeadNew.fileType == "xml_xfce":
|
|
|
|
|
if objProfNew.getError():
|
|
|
|
|
self.setError (_("False profile: " ) + newFile)
|
|
|
|
|
return False
|
|
|
|
@ -3007,7 +3007,7 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
title = title.encode("UTF-8")
|
|
|
|
|
# Замена
|
|
|
|
|
if objHeadNew.typeAppend == "replace":
|
|
|
|
|
if objHeadNew.fileType == "xfce_xml":
|
|
|
|
|
if objHeadNew.fileType == "xml_xfce":
|
|
|
|
|
data = self.newProfile.split("\n")
|
|
|
|
|
data.insert(1,title)
|
|
|
|
|
self.oldProfile = "\n".join(data)
|
|
|
|
@ -3021,7 +3021,7 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
return filesApply
|
|
|
|
|
# Впереди
|
|
|
|
|
elif objHeadNew.typeAppend == "before":
|
|
|
|
|
if objHeadNew.fileType == "xfce_xml":
|
|
|
|
|
if objHeadNew.fileType == "xml_xfce":
|
|
|
|
|
self.setError (\
|
|
|
|
|
_("False option append=before in profile %s") %newFile)
|
|
|
|
|
return False
|
|
|
|
@ -3043,7 +3043,7 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
return filesApply
|
|
|
|
|
# Cзади
|
|
|
|
|
elif objHeadNew.typeAppend == "after":
|
|
|
|
|
if objHeadNew.fileType == "xfce_xml":
|
|
|
|
|
if objHeadNew.fileType == "xml_xfce":
|
|
|
|
|
self.setError (\
|
|
|
|
|
_("False option append=after in profile %s") %newFile)
|
|
|
|
|
return False
|
|
|
|
@ -3083,7 +3083,7 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
+ objHeadNew.fileType + " : " +\
|
|
|
|
|
newFile)
|
|
|
|
|
return False
|
|
|
|
|
if objHeadNew.fileType == "xfce_xml":
|
|
|
|
|
if objHeadNew.fileType == "xml_xfce":
|
|
|
|
|
if objProfNew.getError():
|
|
|
|
|
self.setError (_("False profile: " ) + newFile)
|
|
|
|
|
return False
|
|
|
|
@ -3125,7 +3125,7 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
else:
|
|
|
|
|
exec ("objProfOld=%s(self.oldProfile)"%\
|
|
|
|
|
(objHeadNew.fileType))
|
|
|
|
|
if objHeadNew.fileType == "xfce_xml":
|
|
|
|
|
if objHeadNew.fileType == "xml_xfce":
|
|
|
|
|
if objProfOld.getError():
|
|
|
|
|
self.setError (_("False profile: " ) + oldFile)
|
|
|
|
|
return False
|
|
|
|
@ -3135,12 +3135,12 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
#print "#%s#" %(objProfOld.docObj.body.toprettyxml())
|
|
|
|
|
#print "#%s#" %(objProfNew.docObj.body.toprettyxml())
|
|
|
|
|
objProfOld.join(objProfNew)
|
|
|
|
|
#if objHeadNew.fileType=="xfce_xml":
|
|
|
|
|
#if objHeadNew.fileType=="xml_xfce":
|
|
|
|
|
#print "OLD"
|
|
|
|
|
#print "New"
|
|
|
|
|
#print objProfOld.doc.toprettyxml()
|
|
|
|
|
#print objProfNew.doc.toprettyxml()
|
|
|
|
|
if objHeadNew.fileType == "xfce_xml":
|
|
|
|
|
if objHeadNew.fileType == "xml_xfce":
|
|
|
|
|
if objProfOld.getError():
|
|
|
|
|
self.setError (_("False profile: " ) + newFile)
|
|
|
|
|
return False
|
|
|
|
@ -5046,7 +5046,7 @@ class plasma(samba):
|
|
|
|
|
self.docObj.joinDoc(kdeObj.doc)
|
|
|
|
|
self.postXML()
|
|
|
|
|
|
|
|
|
|
class xfce_xml(_error):
|
|
|
|
|
class xml_xfce(_error):
|
|
|
|
|
"""Класс для объединения xfce-xml файлов"""
|
|
|
|
|
# root нода
|
|
|
|
|
rootNode = False
|
|
|
|
@ -5102,10 +5102,10 @@ class xfce_xml(_error):
|
|
|
|
|
self.bodyNode = self.rootNode
|
|
|
|
|
return self.doc
|
|
|
|
|
|
|
|
|
|
def join(self, xfce_xmlObj):
|
|
|
|
|
def join(self, xml_xfceObj):
|
|
|
|
|
"""Объединяем конфигурации"""
|
|
|
|
|
if isinstance(xfce_xmlObj, xfce_xml):
|
|
|
|
|
self.joinDoc(xfce_xmlObj.doc)
|
|
|
|
|
if isinstance(xml_xfceObj, xml_xfce):
|
|
|
|
|
self.joinDoc(xml_xfceObj.doc)
|
|
|
|
|
|
|
|
|
|
def _removeDropNodesAndAttrAction(self, xmlNode):
|
|
|
|
|
"""Удаляет ноды с аттрибутом action='drop'
|
|
|
|
@ -5143,7 +5143,7 @@ Valid values attribute 'action': \
|
|
|
|
|
# Удаляем теги action и удаляемые ноды
|
|
|
|
|
self._removeDropNodesAndAttrAction(self.bodyNode)
|
|
|
|
|
|
|
|
|
|
def _join(self, xmlNewNode, xmlOldNode, workNode=False):
|
|
|
|
|
def _join(self, xmlNewNode, xmlOldNode, flagRootNode=True):
|
|
|
|
|
"""Объединение корневой ноды профиля и корненвой ноды файла"""
|
|
|
|
|
xmlNode = xmlNewNode
|
|
|
|
|
childNodes = xmlNode.childNodes
|
|
|
|
@ -5186,7 +5186,7 @@ Valid values attribute 'action': \
|
|
|
|
|
findAttrStr = "[%s]"%strAttr
|
|
|
|
|
findPath = u"child::%s%s"%(path,findAttrStr)
|
|
|
|
|
# Рабочая нода
|
|
|
|
|
if not workNode:
|
|
|
|
|
if flagRootNode:
|
|
|
|
|
workNode = xmlOldNode.parentNode
|
|
|
|
|
else:
|
|
|
|
|
workNode = xmlOldNode
|
|
|
|
@ -5207,6 +5207,10 @@ Valid values attribute 'action': \
|
|
|
|
|
elif nAction == "drop":
|
|
|
|
|
flagJoin = False
|
|
|
|
|
flagDrop = True
|
|
|
|
|
if flagRootNode:
|
|
|
|
|
textError = _('Incorrect action="drop" in root node')
|
|
|
|
|
self.setError(textError)
|
|
|
|
|
return False
|
|
|
|
|
if oldNodes:
|
|
|
|
|
if len(oldNodes)>1:
|
|
|
|
|
textError = _("The uncertainty in this profile are \
|
|
|
|
@ -5254,7 +5258,7 @@ the same nodes at one level")
|
|
|
|
|
workNode.appendChild(appendXmlNode)
|
|
|
|
|
if childNodes:
|
|
|
|
|
for node in childNodes:
|
|
|
|
|
if not self._join(node, nextOldNode, True):
|
|
|
|
|
if not self._join(node, nextOldNode, False):
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
if flagError:
|
|
|
|
|