# HG changeset patch # User Sylvain Thénault # Date 1311691750 -7200 # Node ID d07cde311630c2773e89ae1a5c1dcc28d6837107 # Parent 1c7411535c2d6d6ac25a4964603ed5278035d044 [datafeed] properly take care to cwsource=system in imported xml. Closes #1877017 diff -r 1c7411535c2d -r d07cde311630 server/sources/datafeed.py --- a/server/sources/datafeed.py Tue Jul 26 16:35:10 2011 +0200 +++ b/server/sources/datafeed.py Tue Jul 26 16:49:10 2011 +0200 @@ -268,8 +268,11 @@ # if cwsource is specified and repository has a source with the same # name, call extid2eid on that source so entity will be properly seen as # coming from this source - source = session.repo.sources_by_uri.get( - sourceparams.pop('cwsource', None), self.source) + source_uri = sourceparams.pop('cwsource', None) + if source_uri is not None and source_uri != 'system': + source = session.repo.sources_by_uri.get(source_uri, self.source) + else: + source = self.source sourceparams['parser'] = self try: eid = session.repo.extid2eid(source, str(uri), etype, session, diff -r 1c7411535c2d -r d07cde311630 sobjects/test/unittest_parsers.py --- a/sobjects/test/unittest_parsers.py Tue Jul 26 16:35:10 2011 +0200 +++ b/sobjects/test/unittest_parsers.py Tue Jul 26 16:49:10 2011 +0200 @@ -40,7 +40,7 @@ BASEXML = ''.join(u''' - + sthenault toto 2011-01-25 14:14:06 @@ -117,7 +117,12 @@ '''.splitlines() ) + + class CWEntityXMLParserTC(CubicWebTC): + """/!\ this test use a pre-setup database /!\, if you modify above xml, + REMOVE THE DATABASE TEMPLATE else it won't be considered + """ test_db_id = 'xmlparser' @classmethod def pre_setup_database(cls, session, config):