Commit 20b84f26 authored by Aurel's avatar Aurel

sort keys when exporting in xml to make diff more consistent


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4330 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f98985af
...@@ -1404,7 +1404,10 @@ class ModuleTemplateItem(BaseTemplateItem): ...@@ -1404,7 +1404,10 @@ class ModuleTemplateItem(BaseTemplateItem):
def generate_xml(self, path=None): def generate_xml(self, path=None):
dict = self._objects[path] dict = self._objects[path]
xml_data = '<module>' xml_data = '<module>'
for key in dict.keys(): # sort key
keys = dict.keys()
keys.sort()
for key in keys:
if key =='permission_list': if key =='permission_list':
# separe permission dict into xml # separe permission dict into xml
xml_data += os.linesep+' <%s>' %(key,) xml_data += os.linesep+' <%s>' %(key,)
...@@ -1413,6 +1416,7 @@ class ModuleTemplateItem(BaseTemplateItem): ...@@ -1413,6 +1416,7 @@ class ModuleTemplateItem(BaseTemplateItem):
xml_data += os.linesep+' <permission>' xml_data += os.linesep+' <permission>'
xml_data += os.linesep+' <name>%s</name>' %(perm[0]) xml_data += os.linesep+' <name>%s</name>' %(perm[0])
role_list = perm[1] role_list = perm[1]
role_list.sort()
for role in role_list: for role in role_list:
xml_data += os.linesep+' <role>%s</role>' %(role) xml_data += os.linesep+' <role>%s</role>' %(role)
xml_data += os.linesep+' </permission>' xml_data += os.linesep+' </permission>'
...@@ -1486,8 +1490,6 @@ class ModuleTemplateItem(BaseTemplateItem): ...@@ -1486,8 +1490,6 @@ class ModuleTemplateItem(BaseTemplateItem):
dict[id] = str(value) dict[id] = str(value)
self._objects[file_name[:-4]] = dict self._objects[file_name[:-4]] = dict
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
p = context.getPortalObject() p = context.getPortalObject()
id_list = p.objectIds() id_list = p.objectIds()
...@@ -1632,6 +1634,7 @@ class RoleTemplateItem(BaseTemplateItem): ...@@ -1632,6 +1634,7 @@ class RoleTemplateItem(BaseTemplateItem):
def generate_xml(self, path): def generate_xml(self, path):
object=self._objects[path] object=self._objects[path]
xml_data = '<role_list>' xml_data = '<role_list>'
object.sort()
for role in object: for role in object:
xml_data += os.linesep+' <role>%s</role>' %(role) xml_data += os.linesep+' <role>%s</role>' %(role)
xml_data += os.linesep+'</role_list>' xml_data += os.linesep+'</role_list>'
...@@ -1718,6 +1721,7 @@ class CatalogResultKeyTemplateItem(BaseTemplateItem): ...@@ -1718,6 +1721,7 @@ class CatalogResultKeyTemplateItem(BaseTemplateItem):
def generate_xml(self, path=None): def generate_xml(self, path=None):
object=self._objects[path] object=self._objects[path]
xml_data = '<key_list>' xml_data = '<key_list>'
object.sort()
for key in object: for key in object:
xml_data += os.linesep+' <key>%s</key>' %(key) xml_data += os.linesep+' <key>%s</key>' %(key)
xml_data += os.linesep+'</key_list>' xml_data += os.linesep+'</key_list>'
...@@ -1803,6 +1807,7 @@ class CatalogRelatedKeyTemplateItem(BaseTemplateItem): ...@@ -1803,6 +1807,7 @@ class CatalogRelatedKeyTemplateItem(BaseTemplateItem):
def generate_xml(self, path=None): def generate_xml(self, path=None):
object=self._objects[path] object=self._objects[path]
xml_data = '<key_list>' xml_data = '<key_list>'
object.sort()
for key in object: for key in object:
xml_data += os.linesep+' <key>%s</key>' %(key) xml_data += os.linesep+' <key>%s</key>' %(key)
xml_data += os.linesep+'</key_list>' xml_data += os.linesep+'</key_list>'
...@@ -1888,6 +1893,7 @@ class CatalogResultTableTemplateItem(BaseTemplateItem): ...@@ -1888,6 +1893,7 @@ class CatalogResultTableTemplateItem(BaseTemplateItem):
def generate_xml(self, path=None): def generate_xml(self, path=None):
object=self._objects[path] object=self._objects[path]
xml_data = '<key_list>' xml_data = '<key_list>'
object.sort()
for key in object: for key in object:
xml_data += os.linesep+' <key>%s</key>' %(key) xml_data += os.linesep+' <key>%s</key>' %(key)
xml_data += os.linesep+'</key_list>' xml_data += os.linesep+'</key_list>'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment