# HG changeset patch # User Sylvain Thénault # Date 1441695931 -7200 # Node ID 208c9ac8edbbceca8933895ea18d46b1f4f94624 # Parent ef1cfc80d51cb2ae3e22a9eb543b595d28dd53d0 update repo sources on update of source's entities .url attribute diff -r ef1cfc80d51c -r 208c9ac8edbb hooks/syncsources.py --- a/hooks/syncsources.py Wed Dec 09 16:15:00 2015 +0100 +++ b/hooks/syncsources.py Tue Sep 08 09:05:31 2015 +0200 @@ -119,7 +119,7 @@ msg = _("You cannot rename the system source") raise validation_error(self.entity, {('name', 'subject'): msg}) SourceRenamedOp(self._cw, oldname=oldname, newname=newname) - if 'config' in self.entity.cw_edited: + if 'config' in self.entity.cw_edited or 'url' in self.entity.cw_edited: if self.entity.name == 'system' and self.entity.config: msg = _("Configuration of the system source goes to " "the 'sources' file, not in the database") diff -r ef1cfc80d51c -r 208c9ac8edbb server/test/unittest_datafeed.py --- a/server/test/unittest_datafeed.py Wed Dec 09 16:15:00 2015 +0100 +++ b/server/test/unittest_datafeed.py Tue Sep 08 09:05:31 2015 +0200 @@ -142,6 +142,14 @@ self.assertEqual(200, value.getcode()) self.assertEqual('a string', value.geturl()) + def test_update_url(self): + dfsource = self.repo.sources_by_uri[u'ô myfeed'] + with self.admin_access.repo_cnx() as cnx: + cnx.entity_from_eid(dfsource.eid).cw_set(url=u"http://pouet.com\nhttp://pouet.org") + self.assertEqual(dfsource.urls, [u'ignored']) + cnx.commit() + self.assertEqual(dfsource.urls, [u"http://pouet.com", u"http://pouet.org"]) + class DataFeedConfigTC(CubicWebTC):