# HG changeset patch # User Sylvain Thénault # Date 1319181869 -7200 # Node ID 8bd5031e2201b9482ccb70dde9ae0bca9bdc1930 # Parent 64639bc94e25d661853580212aafe73ed3776e64# Parent b6150210f69259857426980ad6b313f1a05e2deb backport stable diff -r 64639bc94e25 -r 8bd5031e2201 .hgignore --- a/.hgignore Thu Oct 20 16:03:51 2011 +0200 +++ b/.hgignore Fri Oct 21 09:24:29 2011 +0200 @@ -14,4 +14,6 @@ .*/data/database/.*\.sqlite .*/data/database/.*\.config .*/data/database/tmpdb.* - +^doc/html/ +^doc/doctrees/ +^doc/book/en/devweb/js_api/ diff -r 64639bc94e25 -r 8bd5031e2201 server/__init__.py --- a/server/__init__.py Thu Oct 20 16:03:51 2011 +0200 +++ b/server/__init__.py Fri Oct 21 09:24:29 2011 +0200 @@ -244,6 +244,8 @@ # execute cubes pre script if any for cube in reversed(cubes): mhandler.cmd_exec_event_script('pre%s' % event, cube) + # execute instance's pre script (useful in tests) + mhandler.cmd_exec_event_script('pre%s' % event, apphome=True) # enter instance'schema into the database session.set_cnxset() serialize_schema(session, schema) @@ -252,6 +254,8 @@ # execute cubes'post script if any for cube in reversed(cubes): mhandler.cmd_exec_event_script('post%s' % event, cube) + # execute instance's post script (useful in tests) + mhandler.cmd_exec_event_script('post%s' % event, apphome=True) # sqlite'stored procedures have to be registered at connection opening time diff -r 64639bc94e25 -r 8bd5031e2201 server/migractions.py --- a/server/migractions.py Thu Oct 20 16:03:51 2011 +0200 +++ b/server/migractions.py Fri Oct 21 09:24:29 2011 +0200 @@ -367,6 +367,8 @@ if cube: cubepath = self.config.cube_dir(cube) apc = osp.join(cubepath, 'migration', '%s.py' % event) + elif kwargs.pop('apphome', False): + apc = osp.join(self.config.apphome, 'migration', '%s.py' % event) else: apc = osp.join(self.config.migration_scripts_dir(), '%s.py' % event) if osp.exists(apc): diff -r 64639bc94e25 -r 8bd5031e2201 server/test/unittest_datafeed.py --- a/server/test/unittest_datafeed.py Thu Oct 20 16:03:51 2011 +0200 +++ b/server/test/unittest_datafeed.py Fri Oct 21 09:24:29 2011 +0200 @@ -37,19 +37,21 @@ self.assertEqual(dfsource.synchro_interval, timedelta(seconds=60)) self.assertFalse(dfsource.fresh()) + class AParser(datafeed.DataFeedParser): __regid__ = 'testparser' def process(self, url, raise_on_error=False): entity = self.extid2entity('http://www.cubicweb.org/', 'Card', - item={'title': u'cubicweb.org', - 'content': u'the cw web site'}) + item={'title': u'cubicweb.org', + 'content': u'the cw web site'}) if not self.created_during_pull(entity): self.notify_updated(entity) def before_entity_copy(self, entity, sourceparams): entity.cw_edited.update(sourceparams['item']) with self.temporary_appobjects(AParser): - stats = dfsource.pull_data(self.session, force=True) + session = self.repo.internal_session() + stats = dfsource.pull_data(session, force=True) self.commit() # test import stats self.assertEqual(sorted(stats.keys()), ['created', 'updated']) @@ -74,13 +76,15 @@ self.assertEqual(self.repo._extid_cache[('http://www.cubicweb.org/', 'system')], entity.eid) # test repull - stats = dfsource.pull_data(self.session, force=True) + session.set_cnxset() + stats = dfsource.pull_data(session, force=True) self.assertEqual(stats['created'], set()) self.assertEqual(stats['updated'], set((entity.eid,))) # test repull with caches reseted self.repo._type_source_cache.clear() self.repo._extid_cache.clear() - stats = dfsource.pull_data(self.session, force=True) + session.set_cnxset() + stats = dfsource.pull_data(session, force=True) self.assertEqual(stats['created'], set()) self.assertEqual(stats['updated'], set((entity.eid,))) self.assertEqual(self.repo._type_source_cache[entity.eid], diff -r 64639bc94e25 -r 8bd5031e2201 server/test/unittest_multisources.py --- a/server/test/unittest_multisources.py Thu Oct 20 16:03:51 2011 +0200 +++ b/server/test/unittest_multisources.py Fri Oct 21 09:24:29 2011 +0200 @@ -30,7 +30,7 @@ class ExternalSource2Configuration(TestServerConfiguration): sourcefile = 'sources_multi' -MTIME = datetime.now() - timedelta(0, 10) +MTIME = datetime.utcnow() - timedelta(0, 10) EXTERN_SOURCE_CFG = u''' pyro-ns-id = extern diff -r 64639bc94e25 -r 8bd5031e2201 server/test/unittest_ssplanner.py --- a/server/test/unittest_ssplanner.py Thu Oct 20 16:03:51 2011 +0200 +++ b/server/test/unittest_ssplanner.py Fri Oct 21 09:24:29 2011 +0200 @@ -16,14 +16,18 @@ # You should have received a copy of the GNU Lesser General Public License along # with CubicWeb. If not, see . -from cubicweb.devtools import init_test_database +from cubicweb.devtools import TestServerConfiguration, get_test_db_handler from cubicweb.devtools.repotest import BasePlannerTC, test_plan from cubicweb.server.ssplanner import SSPlanner # keep cnx so it's not garbage collected and the associated session closed def setUpModule(*args): global repo, cnx - repo, cnx = init_test_database(apphome=SSPlannerTC.datadir) + handler = get_test_db_handler(TestServerConfiguration( + 'data', apphome=SSPlannerTC.datadir)) + handler.build_db_cache() + global repo, cnx + repo, cnx = handler.get_repo_and_cnx() def tearDownModule(*args): global repo, cnx diff -r 64639bc94e25 -r 8bd5031e2201 server/test/unittest_storage.py --- a/server/test/unittest_storage.py Thu Oct 20 16:03:51 2011 +0200 +++ b/server/test/unittest_storage.py Fri Oct 21 09:24:29 2011 +0200 @@ -1,4 +1,4 @@ -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of CubicWeb. @@ -261,7 +261,7 @@ def test_bfss_update_to_None(self): f = self.session.create_entity('Affaire', opt_attr=Binary('toto')) self.session.commit() - self.session.set_pool() + self.session.set_cnxset() f.set_attributes(opt_attr=None) self.session.commit() diff -r 64639bc94e25 -r 8bd5031e2201 web/views/ibreadcrumbs.py --- a/web/views/ibreadcrumbs.py Thu Oct 20 16:03:51 2011 +0200 +++ b/web/views/ibreadcrumbs.py Fri Oct 21 09:24:29 2011 +0200 @@ -163,7 +163,7 @@ xml_escape(url), xml_escape(uilib.cut(title, textsize)))) else: textsize = self._cw.property_value('navigation.short-line-size') - w(uilib.cut(unicode(part), textsize)) + w(xml_escape(uilib.cut(unicode(part), textsize))) class BreadCrumbETypeVComponent(BreadCrumbEntityVComponent):