From ab241d2530400008925b585640d23d4c2fea643c Mon Sep 17 00:00:00 2001 From: amercader Date: Tue, 13 May 2014 15:30:34 +0100 Subject: [PATCH] Pass defer_commit in context on get_site_user calls See ckan/ckan#1714. Until that is fixed properly, the `defer_commit` flag avoids some `DetachedInstanceErrors` happening during the harvesting. --- ckanext/spatial/harvesters/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ckanext/spatial/harvesters/base.py b/ckanext/spatial/harvesters/base.py index 9122b61..7fb946b 100644 --- a/ckanext/spatial/harvesters/base.py +++ b/ckanext/spatial/harvesters/base.py @@ -655,7 +655,11 @@ class SpatialHarvester(HarvesterBase): if self._user_name: return self._user_name - self._site_user = p.toolkit.get_action('get_site_user')({'model': model, 'ignore_auth': True}, {}) + context = {'model': model, + 'ignore_auth': True, + 'defer_commit': True, # See ckan/ckan#1714 + } + self._site_user = p.toolkit.get_action('get_site_user')(context, {}) config_user_name = config.get('ckanext.spatial.harvest.user_name') if config_user_name: