--- 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/
--- 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<event> script if any
for cube in reversed(cubes):
mhandler.cmd_exec_event_script('pre%s' % event, cube)
+ # execute instance's pre<event> 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<event> script if any
for cube in reversed(cubes):
mhandler.cmd_exec_event_script('post%s' % event, cube)
+ # execute instance's post<event> 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
--- 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):
--- 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],
--- 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
--- 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 <http://www.gnu.org/licenses/>.
-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
--- 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()
--- 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):