# HG changeset patch # User Sylvain Thénault # Date 1475249651 -7200 # Node ID 7518cb58ab4c47979188ac6744e46173f60c4958 # Parent 78c8a2bb04ff54b022f3903cb9b9539fced912c2 [entity] Stop returning source information in cw_metainformation() We should not need that. It has been introduced to handle things we should not do and probably don't do anymore (e.g. attempting to grasp recursive import of several sites). Related to #15538288. diff -r 78c8a2bb04ff -r 7518cb58ab4c cubicweb/entity.py --- a/cubicweb/entity.py Fri Sep 30 17:04:42 2016 +0200 +++ b/cubicweb/entity.py Fri Sep 30 17:34:11 2016 +0200 @@ -625,9 +625,7 @@ @cached def cw_metainformation(self): - metas = self._cw.entity_metas(self.eid) - metas['source'] = self._cw.source_defs()[metas['source']] - return metas + return self._cw.entity_metas(self.eid) def cw_check_perm(self, action): self.e_schema.check_perm(self._cw, action, eid=self.eid) diff -r 78c8a2bb04ff -r 7518cb58ab4c cubicweb/server/test/unittest_datafeed.py --- a/cubicweb/server/test/unittest_datafeed.py Fri Sep 30 17:04:42 2016 +0200 +++ b/cubicweb/server/test/unittest_datafeed.py Fri Sep 30 17:34:11 2016 +0200 @@ -86,7 +86,6 @@ self.assertEqual(entity.cw_source[0].name, u'ô myfeed') self.assertEqual(entity.cw_metainformation(), {'type': 'Card', - 'source': {'uri': u'ô myfeed', 'type': 'datafeed', 'use-cwuri-as-url': True}, 'extid': b'http://www.cubicweb.org/'} ) # test repo cache keys @@ -107,7 +106,6 @@ self.assertEqual(entity.cw_source[0].name, 'myrenamedfeed') self.assertEqual(entity.cw_metainformation(), {'type': 'Card', - 'source': {'uri': 'myrenamedfeed', 'type': 'datafeed', 'use-cwuri-as-url': True}, 'extid': b'http://www.cubicweb.org/'} ) self.assertEqual(self.repo._type_source_cache[entity.eid], diff -r 78c8a2bb04ff -r 7518cb58ab4c cubicweb/server/test/unittest_ldapsource.py --- a/cubicweb/server/test/unittest_ldapsource.py Fri Sep 30 17:04:42 2016 +0200 +++ b/cubicweb/server/test/unittest_ldapsource.py Fri Sep 30 17:34:11 2016 +0200 @@ -284,10 +284,7 @@ self.assertEqual(len(rset), 1) e = rset.get_entity(0, 0) self.assertEqual(e.eid, eid) - self.assertEqual(e.cw_metainformation(), {'source': {'type': u'native', - 'uri': u'system', - 'use-cwuri-as-url': False}, - 'type': 'CWUser', + self.assertEqual(e.cw_metainformation(), {'type': 'CWUser', 'extid': None}) self.assertEqual(e.cw_source[0].name, 'system') self.assertTrue(e.creation_date) @@ -297,10 +294,7 @@ self.assertEqual(len(rset), 1) self.assertTrue(self.repo.system_source.authenticate(cnx, 'syt', password='syt')) # make sure the pull from ldap have not "reverted" user as a ldap-feed user - self.assertEqual(e.cw_metainformation(), {'source': {'type': u'native', - 'uri': u'system', - 'use-cwuri-as-url': False}, - 'type': 'CWUser', + self.assertEqual(e.cw_metainformation(), {'type': 'CWUser', 'extid': None}) # and that the password stored in the system source is not empty or so user = cnx.execute('CWUser U WHERE U login "syt"').get_entity(0, 0) diff -r 78c8a2bb04ff -r 7518cb58ab4c cubicweb/test/unittest_entity.py --- a/cubicweb/test/unittest_entity.py Fri Sep 30 17:04:42 2016 +0200 +++ b/cubicweb/test/unittest_entity.py Fri Sep 30 17:34:11 2016 +0200 @@ -835,9 +835,7 @@ with self.admin_access.web_request() as req: note = req.create_entity('Note', type=u'z') metainf = note.cw_metainformation() - self.assertEqual(metainf, {'source': {'type': 'native', 'uri': 'system', - 'use-cwuri-as-url': False}, - 'type': u'Note', 'extid': None}) + self.assertEqual(metainf, {'type': u'Note', 'extid': None}) def test_absolute_url_empty_field(self): with self.admin_access.web_request() as req: diff -r 78c8a2bb04ff -r 7518cb58ab4c cubicweb/web/views/xmlrss.py --- a/cubicweb/web/views/xmlrss.py Fri Sep 30 17:04:42 2016 +0200 +++ b/cubicweb/web/views/xmlrss.py Fri Sep 30 17:34:11 2016 +0200 @@ -77,7 +77,7 @@ def entity_call(self, entity): """element as an item for an xml feed""" entity.complete() - source = entity.cw_metainformation()['source']['uri'] + source = entity.cw_source[0].name self.w(u'<%s eid="%s" cwuri="%s" cwsource="%s">\n' % (entity.cw_etype, entity.eid, xml_escape(entity.cwuri), xml_escape(source)))