[web/views] Use predictable ordering for attributes in entity XML view
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 12 Feb 2015 18:52:04 +0100
changeset 10245 7d21c6ac47a3
parent 10244 485c7df50ca7
child 10246 ef106564b523
[web/views] Use predictable ordering for attributes in entity XML view Fixes test under python -R. Related to #4959402.
web/test/unittest_views_xmlrss.py
web/views/xmlrss.py
--- a/web/test/unittest_views_xmlrss.py	Fri Feb 13 09:46:19 2015 +0100
+++ b/web/test/unittest_views_xmlrss.py	Thu Feb 12 18:52:04 2015 +0100
@@ -11,13 +11,13 @@
                 req.user.view('xml'),
                 '''\
 <CWUser eid="6" cwuri="http://testing.fr/cubicweb/6" cwsource="system">
+  <creation_date>%(cdate)s</creation_date>
+  <firstname/>
+  <last_login_time/>
   <login>admin</login>
-  <upassword/>
-  <firstname/>
+  <modification_date>%(mdate)s</modification_date>
   <surname/>
-  <last_login_time/>
-  <creation_date>%(cdate)s</creation_date>
-  <modification_date>%(mdate)s</modification_date>
+  <upassword/>
   <tags role="object">
   </tags>
   <in_group role="subject">
--- a/web/views/xmlrss.py	Fri Feb 13 09:46:19 2015 +0100
+++ b/web/views/xmlrss.py	Thu Feb 12 18:52:04 2015 +0100
@@ -79,7 +79,7 @@
         self.w(u'<%s eid="%s" cwuri="%s" cwsource="%s">\n'
                % (entity.cw_etype, entity.eid, xml_escape(entity.cwuri),
                   xml_escape(source)))
-        for rschema, attrschema in entity.e_schema.attribute_definitions():
+        for rschema, attrschema in sorted(entity.e_schema.attribute_definitions()):
             attr = rschema.type
             if attr in ('eid', 'cwuri'):
                 continue