diff --git a/pym/cl_profile.py b/pym/cl_profile.py
index ccd3656..cde1513 100644
--- a/pym/cl_profile.py
+++ b/pym/cl_profile.py
@@ -6017,7 +6017,6 @@ Valid values attribute 'action': \
self.setError(textError)
return False
if xmlOldNode.parentNode:
- findStr = u"child::%s"%path
strAttr = [attrName, attrType]
findAttr = filter(lambda x: x, strAttr)
findAttrStr = ''
@@ -6256,7 +6255,6 @@ Valid values attribute 'action': \
self.setError(textError)
return False
if xmlOldNode.parentNode:
- findStr = u"child::%s"%path
findAttrStr = ""
if attrName:
findAttrStr = "[%s]"%attrName
@@ -6506,7 +6504,8 @@ class xml_gconf(xml_xfce):
"""Сравнение содержимого двух списков XML нод"""
getTextsNodes = lambda y: map(lambda x:\
x.toxml().replace(" ","").replace("\t","").replace("\n",""),
- map(lambda x: x.removeAttribute("mtime") or x,
+ map(lambda x: x.hasAttribute("mtime") and\
+ x.removeAttribute("mtime") or x,
map(lambda x: x.cloneNode(True),
filter(lambda x: x.nodeType==x.ELEMENT_NODE, y))))
if set(getTextsNodes(listXmlA))==set(getTextsNodes(listXmlB)):
@@ -6528,13 +6527,16 @@ class xml_gconf(xml_xfce):
nName = u''
nType = u''
nValue = u''
+ nSchema = u''
attrName = ''
- attrType = ''
if flagRootNode:
if not tagName == "gconf":
self.setError(_("The text is not a valid gconf-XML format \
(not found '...')"))
return False
+ flagType = False
+ flagValue = False
+ flagSchema = False
else:
if not tagName == "entry":
self.setError(_("The text is not a valid gconf-XML format \
@@ -6543,20 +6545,27 @@ class xml_gconf(xml_xfce):
if not n.hasAttribute("name"):
self.setError(_('Not found arrtibute "name" in tag entry'))
return False
- if not n.hasAttribute("type"):
+ flagType = n.hasAttribute("type")
+ flagValue = False
+ flagSchema = n.hasAttribute("schema")
+ if flagSchema:
+ nSchema = n.getAttribute("schema")
+ if not flagType and not flagSchema:
self.setError(_('Not found arrtibute "type" in tag entry'))
return False
nName = n.getAttribute("name")
attrName = u"attribute::name='%s'"%nName
- nType = n.getAttribute("type")
- # Проверка правильности аттрибута type
- if not nType in self.supportEntryTypes:
- self.setError(\
- _('Incorrect arrtibute "type" - ')%nType)
- return False
- attrType = u"attribute::type='%s'"%nType
- if n.hasAttribute("value"):
- nValue = n.getAttribute("value")
+ if flagType:
+ flagValue = n.hasAttribute("value")
+ nType = n.getAttribute("type")
+ # Проверка правильности аттрибута type
+ if not nType in self.supportEntryTypes:
+ self.setError(\
+ _('Incorrect arrtibute "type" - ')\
+ %nType)
+ return False
+ if flagValue:
+ nValue = n.getAttribute("value")
if n.hasAttribute("action"):
nAction = n.getAttribute("action")
if not nAction in ("join","replace","drop"):
@@ -6567,13 +6576,9 @@ Valid values attribute 'action': \
self.setError(textError)
return False
if xmlOldNode.parentNode:
- findStr = u"child::%s"%tagName
- strAttr = [attrName, attrType]
- findAttr = filter(lambda x: x, strAttr)
- findAttrStr = ''
- if findAttr:
- strAttr = u' and '.join(findAttr)
- findAttrStr = "[%s]"%strAttr
+ findAttrStr = ""
+ if attrName:
+ findAttrStr = "[%s]"%attrName
findPath = u"child::%s%s"%(tagName,findAttrStr)
# Рабочая нода
if flagRootNode:
@@ -6581,16 +6586,19 @@ Valid values attribute 'action': \
else:
workNode = xmlOldNode
oldNodes = xpath.Evaluate(findPath, workNode)
- # Новая нода список
- flagArray = False
- if nType == "list" or nType == "pair":
- flagArray = True
- flagDrop = False
+ # По умолчанию - объединение
flagJoin = True
flagReplace = False
+ flagDrop = False
+ # Замещаем ноду
if nType=="string" or nAction=="replace":
flagJoin = False
flagReplace = True
+ # Замещаем ноду в случае массива
+ elif nType == "list" or nType == "pair":
+ flagJoin = False
+ flagReplace = True
+ # Удаляем ноду
elif nAction == "drop":
flagJoin = False
flagDrop = True
@@ -6605,29 +6613,34 @@ the same nodes at one level")
self.setError(textError)
return False
nextOldNode = oldNodes[0]
- # Замещаем ноду в случае массива
- if flagArray and not flagDrop:
- replaceXmlNode = xmlNode.cloneNode(True)
- # Сравнение содержимого нод
- if not self.cmpListsNodesEntry([replaceXmlNode],
- [nextOldNode]):
- replaceXmlNode.setAttribute("mtime",
- self.currentTime)
- if nAction:
- replaceXmlNode.removeAttribute("action")
- workNode.replaceChild(replaceXmlNode,
- nextOldNode)
- flagJoin = False
- flagReplace = False
- childNodes = False
# Объединение нод
if flagJoin:
- if nextOldNode.hasAttribute("value"):
- oValue = nextOldNode.getAttribute("value")
- if nValue != oValue:
+ if flagType and flagValue:
+ flagChange = False
+ foundValue = nextOldNode.hasAttribute("value")
+ if foundValue:
+ oValue = nextOldNode.getAttribute("value")
+ if nValue != oValue:
+ flagChange = True
+ else:
+ flagChange = True
+ if flagChange:
nextOldNode.setAttribute("mtime",
self.currentTime)
nextOldNode.setAttribute("value",nValue)
+ elif flagSchema:
+ flagChange = False
+ foundValue = nextOldNode.hasAttribute("schema")
+ if foundValue:
+ oSchema = nextOldNode.getAttribute("schema")
+ if nSchema != oSchema:
+ flagChange = True
+ else:
+ flagChange = True
+ if flagChange:
+ nextOldNode.setAttribute("mtime",
+ self.currentTime)
+ nextOldNode.setAttribute("schema",nSchema)
# Замещение ноды
elif flagReplace:
replaceXmlNode = xmlNode.cloneNode(True)
@@ -6677,7 +6690,7 @@ the same nodes at one level")
self.joinDoc(xml_gconfObj.doc)
except:
self.setError(_("Can not join profile"))
- return False
+ return False
return True
def getConfig(self):