From 20b84f26a9090e17bce9b11c38e743f2c9927fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Tue, 15 Nov 2005 16:01:20 +0000 Subject: [PATCH] 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 --- product/ERP5/Document/BusinessTemplate.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 07a30f0806..77a908375a 100755 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -1404,7 +1404,10 @@ class ModuleTemplateItem(BaseTemplateItem): def generate_xml(self, path=None): dict = self._objects[path] xml_data = '<module>' - for key in dict.keys(): + # sort key + keys = dict.keys() + keys.sort() + for key in keys: if key =='permission_list': # separe permission dict into xml xml_data += os.linesep+' <%s>' %(key,) @@ -1413,6 +1416,7 @@ class ModuleTemplateItem(BaseTemplateItem): xml_data += os.linesep+' <permission>' xml_data += os.linesep+' <name>%s</name>' %(perm[0]) role_list = perm[1] + role_list.sort() for role in role_list: xml_data += os.linesep+' <role>%s</role>' %(role) xml_data += os.linesep+' </permission>' @@ -1486,8 +1490,6 @@ class ModuleTemplateItem(BaseTemplateItem): dict[id] = str(value) self._objects[file_name[:-4]] = dict - - def uninstall(self, context, **kw): p = context.getPortalObject() id_list = p.objectIds() @@ -1632,6 +1634,7 @@ class RoleTemplateItem(BaseTemplateItem): def generate_xml(self, path): object=self._objects[path] xml_data = '<role_list>' + object.sort() for role in object: xml_data += os.linesep+' <role>%s</role>' %(role) xml_data += os.linesep+'</role_list>' @@ -1718,6 +1721,7 @@ class CatalogResultKeyTemplateItem(BaseTemplateItem): def generate_xml(self, path=None): object=self._objects[path] xml_data = '<key_list>' + object.sort() for key in object: xml_data += os.linesep+' <key>%s</key>' %(key) xml_data += os.linesep+'</key_list>' @@ -1803,6 +1807,7 @@ class CatalogRelatedKeyTemplateItem(BaseTemplateItem): def generate_xml(self, path=None): object=self._objects[path] xml_data = '<key_list>' + object.sort() for key in object: xml_data += os.linesep+' <key>%s</key>' %(key) xml_data += os.linesep+'</key_list>' @@ -1888,6 +1893,7 @@ class CatalogResultTableTemplateItem(BaseTemplateItem): def generate_xml(self, path=None): object=self._objects[path] xml_data = '<key_list>' + object.sort() for key in object: xml_data += os.linesep+' <key>%s</key>' %(key) xml_data += os.linesep+'</key_list>' -- 2.30.9